laidback01 Posted December 20, 2007 Share Posted December 20, 2007 Hey, I want to convert this script from M$ Technet: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colNetAdapters = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") For Each objNetAdapter In colNetAdapters errEnable = objNetAdapter.EnableDHCP() Next Anyway, can someone else do it their way? See, what I'm doing, is trying to make sure I try it first, and I'll come back later for the answer! Hopefully that makes sense. thanks, Jack Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 21, 2007 Share Posted December 21, 2007 (edited) Hey, I want to convert this script from M$ Technet: strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colNetAdapters = objWMIService.ExecQuery _ ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") For Each objNetAdapter In colNetAdapters errEnable = objNetAdapter.EnableDHCP() Next First, put a dollar sign at the beginning of each variable name. Second, remove every 'Set' command, as AutoIt doesn't use them. Change GetObject() to ObjGet(). Take the word 'Each' out of the For/Next loop, AutoIt doesn't use it. That should make it work. If you are still stuck, post your version and you'll get plenty of help. Edited December 21, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
laidback01 Posted December 21, 2007 Author Share Posted December 21, 2007 First, put a dollar sign at the beginning of each variable name.Second, remove every 'Set' command, as AutoIt doesn't use them.Change GetObject() to ObjGet().Take the word 'Each' out of the For/Next loop, AutoIt doesn't use it.That should make it work. If you are still stuck, post your version and you'll get plenty of help. Heh, I just found out there is excellent documentation in the Scite Editor... Since I didn't see it on the website, I made the stupid assumption that there was no language ref or anything, and that I just just learn from others' code. Heh, life will go very well indeed now that I have printed off the 496 sheets of help file! Fantastic docs, thanks be to whomever did that! Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 21, 2007 Share Posted December 21, 2007 Heh, I just found out there is excellent documentation in the Scite Editor... Since I didn't see it on the website, I made the stupid assumption that there was no language ref or anything, and that I just just learn from others' code. Heh, life will go very well indeed now that I have printed off the 496 sheets of help file! Fantastic docs, thanks be to whomever did that!Tree Killer!Printed it out...?! Dude how... how... last millennium! AutoIt ships with a very good help file (AutoIt3.chm). It is the complete language reference, contains a couple of introductory tutorials, and has example scripts for almost every function. Every time I sit down to AutoIt, I keep the help file open (on the index tab, since I usually know what I'm looking for) for reference.But it never occurred to me to print it out! A new help file comes out with every production and beta version. AutoIt's development team is very active, so that's pretty often. It just doesn't make sense to try and keep an up-to-date hard copy around.I'll bet you chopped down a real tree for Christmas too, didn't ya? Merry Christmas anyway! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
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