dbenoit Posted October 31, 2008 Share Posted October 31, 2008 Hello, I tryed to make my exisiting scrypts running when the OS is not install on C: (for exemple H:\). Unfortuantly, each time I am using a function call to something involve Windows API, it fail on error. For exemple _CreateService("", $servicename, "My Service", @WindowsDir & "\srvany.exe", "LocalSystem", "", 0x110) _ComputerGetProcessors(ByRef $aProcessorInfo) _ComputerGetGroups Do not work any more and generate a "not object" error. I suppose this is becaue of the global variable but I do not know what and wher I have something to change. Thnks for your help. Dominique Link to comment Share on other sites More sharing options...
oMBRa Posted October 31, 2008 Share Posted October 31, 2008 we cant help u unless u post your code Link to comment Share on other sites More sharing options...
dbenoit Posted October 31, 2008 Author Share Posted October 31, 2008 we cant help u unless u post your code Here is a quick exemple : Global $ERR_NO_INFO = "Array contains no information", _ $ERR_NOT_OBJ = "$colItems isnt an object" Dim $Processors, $pos[2] If Not (IsDeclared("$cI_CompName")) Then Global $cI_CompName = @ComputerName Global $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20 msgbox(0,"My CPU is : ", _ComputerGetProcessors($Processors)) Exit Func _ComputerGetProcessors(ByRef $aProcessorInfo) Local $colItems, $objWMIService, $objItem Dim $aProcessorInfo[1][42], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems ReDim $aProcessorInfo[uBound($aProcessorInfo) + 1][42] $aProcessorInfo[$i][0] = StringStripWS($objItem.Name, 1) $aProcessorInfo[$i][37] = $objItem.SystemName $i += 1 Next $aProcessorInfo[0][0] = UBound($aProcessorInfo) - 1 If $aProcessorInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Else SetError(1, 2, 0) EndIf Return $aProcessorInfo[1][0] EndFunc ;==>_ComputerGetProcessors This code works fine when XP is installed on C: but When XP is installed on H:, then after 30 seconds wait, it ends with the folowing message >"H:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "H:\Documents and Settings\planet\Desktop\New AutoIt v3 Script.au3" H:\Documents and Settings\planet\Desktop\New AutoIt v3 Script.au3 (22) : ==> Variable must be of type "Object".: $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) $colItems = $objWMIService^ ERROR >Exit code: 1 Time: 30.314 I hope this will be enough for you to help me. Kind regards Dominique Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 31, 2008 Share Posted October 31, 2008 Your code works fine for me (Windows XP 64 bit, installed on drive E:). Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
dbenoit Posted October 31, 2008 Author Share Posted October 31, 2008 Your code works fine for me (Windows XP 64 bit, installed on drive E:).Could you please tell me what release of AutoIt you are using ? Is it a beta one ?Many thanks for having done the test. I am very upset by this issue (on my side) because I have something like 25.000 lines of Autoit code so far and I would like to see them working fine even in such situation.Kind regardsDominique Link to comment Share on other sites More sharing options...
dbzfanatic Posted October 31, 2008 Share Posted October 31, 2008 I'm running 3.2.12.1 stable on this machine. Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote] Link to comment Share on other sites More sharing options...
dbenoit Posted October 31, 2008 Author Share Posted October 31, 2008 Hello, I downloaded the same release, but I get the same error. My trouble is due to $objWMIService.ExecQuery I don't know why. I am not easy at all with this kind of call. Do you have any idea of where I have to look at ? Kind regards Dominique Link to comment Share on other sites More sharing options...
rover Posted November 1, 2008 Share Posted November 1, 2008 (edited) Hello,I downloaded the same release, but I get the same error.My trouble is due to $objWMIService.ExecQueryI don't know why. I am not easy at all with this kind of call. Do you have any idea of where I have to look at ?Kind regardsDominique@dbenoitThe Windows Management Instrumentation service on that machine is disabledthere are a few service UDFS on the forum you could use to check WMI service status before running any WMI codeCheersEdit: missing end of quote bracket Edited November 1, 2008 by rover I see fascists... Link to comment Share on other sites More sharing options...
dbenoit Posted November 1, 2008 Author Share Posted November 1, 2008 @dbenoitThe Windows Management Instrumentation service on that machine is disabledthere are a few service UDFS on the forum you could use to check WMI service status before running any WMI codeCheersEdit: missing end of quote bracketThank, You are right. The problem is due to WMI service which is not started on my test PC.Kind regardsDominique 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