Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


WMI collection in a For-Next loop

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1823
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WMI collection in a For-Next loop
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 WMI collection in a For-Next loop - 1/11/2005 6:12:12 PM   
  neillnsteph

 

Posts: 3
Score: 0
Joined: 1/11/2005
From:
Status: offline
I've got the code below running but I'd like to use a For-Next loop instead of a For-Each loop and iterate through the collection in a row-wise fashion based on the value of the variable specified in the For-Next.


      

It would be boring and tedious for me to explain why I don't want to use a For-Each loop, but trust me, I NEED to use a For-Next. The reason has nothing to do with not having to manage the counter inside the For-Each. Can anybody tell me how to refer to the members of the collection by number? Something like this would be great but it doesn't work.


      

Thanks in advance.

Neill in Phoenix
 
 
Post #: 1
 
 Re: WMI collection in a For-Next loop - 1/11/2005 9:08:56 PM   
  Zifter


Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
Hi neillnsteph,

Unfortunately the files collection hasn't got an index property.
In order to accomplish what you want to do, you'll have to put each file of the files collection in an array (with a for each loop) and then use a for next loop to iterate through the array.

HTH

(in reply to neillnsteph)
 
 
Post #: 2
 
 Re: WMI collection in a For-Next loop - 1/12/2005 1:02:53 AM   
  neillnsteph

 

Posts: 3
Score: 0
Joined: 1/11/2005
From:
Status: offline
Thanks for the speedy reply.

OK, here's where the tedious part comes in. I'm doing this work in an environment which uses a dialect of VB (called SQABasic). That dialect is quite dated and doesn't support For-Each. It can, however, do everything else I need (like working with ADO recordsets). I guess at this point I'm just outa' luck, huh?

I would have thought that an index property would be common to all collections. Where can I find a reference that will tell me the full set of properties and methods that are available for WMI collections?

Thanks again,
N

(in reply to neillnsteph)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> WMI collection in a For-Next loop Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts