mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2007
Posts: 37
C
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.
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
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
Joined: Sep 2005
Posts: 2,881
H
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.

Joined: May 2007
Posts: 37
C
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!


Link Copied to Clipboard