zhao Posted July 25, 2007 Posted July 25, 2007 I'm learning WMI now ,but autoit doesn't have a "FOR EACH...IN..." statement. So some WMI examples in MSDN cannot run in autoit. such as the code bellow: $strComputer = "." $objWMIService = ObjGet ("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & $strComputer & "\root\cimv2") $colScheduledJobs = $objWMIService.ExecQuery _ ("Select * from Win32_ScheduledJob") For Each objJob in $colScheduledJobs ConsoleWrite( "Job ID: " & objJob.JobId & _ "Command: " & objJob.Command) Next How can I deal with it?
xcal Posted July 25, 2007 Posted July 25, 2007 (edited) Leave out the 'Each.' For $item in $array etc... edit - First post, I win. Edited July 25, 2007 by xcal How To Ask Questions The Smart Way
Developers Jos Posted July 25, 2007 Developers Posted July 25, 2007 For <$Variable> In <expression> statements ... Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
lordofthestrings Posted July 25, 2007 Posted July 25, 2007 (edited) look at this one if you're using WMI in AutoIt..This might allready help you getting started quicker..http://www.autoitscript.com/forum/index.ph...0534&hl=WMIby the way.. The for commando has nothing to do with WMI, it's basic VBScript.it's just the scripts way of looping through the returned collection of data..have a nice day.. Edited July 25, 2007 by lordofthestrings
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now