Roman Posted August 31, 2006 Share Posted August 31, 2006 Hi I have wrote this function: Func ServiceChangeStartMode($ServiceName, $ServiceStartMode) $oColListOfServices = $oWMIService.ExecQuery ("SELECT * FROM Win32_Service WHERE Name='" & $ServiceName & "'") For $oObjService in $oColListOfServices ; Solution 1: $oObjService.ChangeStartMode($ServiceStartMode) ; Solution 2: $oObjService.Change( , , , , $ServiceStartMode) Next If @error Or Not IsObj($oObjService) Then Exit EndFunc The code line below remark "Solution 1" works, the code line below remark "Solution 2" does not. (Of course i use either the first or the second code line, not both together) The reason i found in Solultion 2 is, that i can't skip the four preceding parameters of this method this way; the method either allways interpretes all inside the brackets as the first parameter or i get an syntax error like in this case. Knows anybody how to use the change method of the Win32_Service class correctly? Sorry about my english. Thanks for all suggestions! Roman. Link to comment Share on other sites More sharing options...
GaryFrost Posted August 31, 2006 Share Posted August 31, 2006 http://www.autoitscript.com/forum/index.ph...mp;#entry225095 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
SvenP Posted August 31, 2006 Share Posted August 31, 2006 Hi I have wrote this function: Func ServiceChangeStartMode($ServiceName, $ServiceStartMode) $oColListOfServices = $oWMIService.ExecQuery ("SELECT * FROM Win32_Service WHERE Name='" & $ServiceName & "'") For $oObjService in $oColListOfServices ; Solution 1: $oObjService.ChangeStartMode($ServiceStartMode) ; Solution 2: $oObjService.Change( , , , , $ServiceStartMode) Next If @error Or Not IsObj($oObjService) Then Exit EndFunc ...Hello Roman, The 'empty arguments' syntax has been replaced by the 'default' keyword since AutoIt beta version 3.1.1.xx (oops, forgot the exact version number). So the line would be: ; Solution 2: $oObjService.Change(default ,default , default , default , $ServiceStartMode) Regards, -Sven Link to comment Share on other sites More sharing options...
Roman Posted September 1, 2006 Author Share Posted September 1, 2006 Hello Roman, The 'empty arguments' syntax has been replaced by the 'default' keyword since AutoIt beta version 3.1.1.xx (oops, forgot the exact version number). So the line would be: ; Solution 2: $oObjService.Change(default ,default , default , default , $ServiceStartMode) Regards, -Sven Thanks a lot! I will try it... Regards, Roman. 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