mIRC Home    About    Download    Register    News    Help

Print Thread
Dispatching items in a collection (COM) #223472 25/07/10 06:51 PM
Joined: May 2007
Posts: 37
C
Chessnut Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: May 2007
Posts: 37
Another COM related question!

I know that $comval exists for enumerating through collections, but the problem I have is that I want to dispatch one item in particular in the collection.

In other words, does there exist something along the lines of $comval(a,1,dispatch* b) to dispatch the Nth item in a collection?

Thanks!

Last edited by Chessnut; 25/07/10 07:00 PM.
Re: Dispatching items in a collection (COM) [Re: Chessnut] #223474 25/07/10 08:19 PM
Joined: Apr 2010
Posts: 966
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 966
Not usre if it works, but have you tryed:
Code:
alias vid {
  var %a, %b, %c
  .comopen %a WbemScripting.SWbemLocator
  noop $com(%a,ConnectServer,3,dispatch* %b)
  noop $com(%b,ExecQuery,3,bstr*,select [I] from [P], dispatch* %c)
  noop $com(%c,...,dispatch* %d)
  ;do stuff with %d
  .comclose %d
  .comclose %c
  .comclose %b
  .comclose %a
}
WHere [I] is what you want to query, and [P] is what to query, then just use dispatch to %d.

As I said, not sure if it worx, but you can try smile


I am SReject
My Stuff
Re: Dispatching items in a collection (COM) [Re: Chessnut] #223476 25/07/10 08:48 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
This is another limitation in mIRC that we currently can't get around, however, a lot of objects offer an "item" method to retrieve an item from the collection. Depending on what you're using, you could probably do:

Code:
$com(object,item,3,int,<N>,dispatch* newobject)


Where <N> is the number in the collection you want to retrieve..

Obviously not all objects have this, but some do. The Windows Media Player object model is a prime example.

Re: Dispatching items in a collection (COM) [Re: FroggieDaFrog] #223479 25/07/10 09:24 PM
Joined: May 2007
Posts: 37
C
Chessnut Offline OP
Ameglian cow
OP Offline
Ameglian cow
C
Joined: May 2007
Posts: 37
Bleurgh, mIRC's COM support is crap frown

Unfortunately I need to iterate through the collection to determine which item I want as I need one with a specific value assigned to a property of it.

FroggieDaFrog, I haven't seen that method before - I'll have a look into it.

Thanks both of you!