Negative1 Posted April 28, 2009 Posted April 28, 2009 Hi all, Heres a snippet of the code that throws up the error: #include <WinAPI.au3> $core = 1 if $core=1 Then $sPID=processexists("Processor Benchmarking2.exe") $hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $sPID) $aRet = _WinAPI_GetProcessAffinityMask($hProc) _WinAPI_SetProcessAffinityMask($hProc,0x01);Set affinity for dual core _WinAPI_CloseHandle($hProc) Elseif $core=2 Then $sPID=processexists("Processor Benchmarking2.exe") $hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $sPID) $aRet = _WinAPI_GetProcessAffinityMask($hProc) _WinAPI_SetProcessAffinityMask($hProc,0x03);Set affinity for dual core _WinAPI_CloseHandle($hProc) EndIf the Error reported: C:\Documents and Settings\Gray_Paul\My Documents\Scripting\Testbed\processor benchmarking2.au3(386,51) : WARNING: $PROCESS_ALL_ACCESS: possibly used before declaration. $hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Documents and Settings\Gray_Paul\My Documents\Scripting\Testbed\processor benchmarking2.au3(386,51) : ERROR: $PROCESS_ALL_ACCESS: undeclared global variable. $hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ Now the strange thing is i took this code from another one of my programs that works absolutely fine. Any ideas? thanks in advance -1 What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.
ChrisFromBoston Posted April 28, 2009 Posted April 28, 2009 Doesn't look like you're defining PROCESS_ALL_ACCESS anywhere. I googled for the value, and I think this should work: Global Const $PROCESS_ALL_ACCESS = 0x1f0fff Also, you should check $sPID before you try and call OpenProcess, if it doesn't exist as a process, your script will bomb.
Negative1 Posted April 28, 2009 Author Posted April 28, 2009 Doesn't look like you're defining PROCESS_ALL_ACCESS anywhere. I googled for the value, and I think this should work:Global Const $PROCESS_ALL_ACCESS = 0x1f0fffAlso, you should check $sPID before you try and call OpenProcess, if it doesn't exist as a process, your script will bomb.No go with that but thanks for the idea... Strange thing though is im using this code in another program and it works...Also in the main script i check processexsists first. What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.
ChrisFromBoston Posted April 28, 2009 Posted April 28, 2009 No go with that but thanks for the idea... Strange thing though is im using this code in another program and it works...Well now that you're defining it, you should at least be getting a different error, no?
Negative1 Posted April 28, 2009 Author Posted April 28, 2009 #include <Constants.au3> damn damn damn....sorry all for the wasting of forum space What are we going to do tonight Brain?Same thing we do every night Pinky try to automate the world.
rajeshontheweb Posted April 28, 2009 Posted April 28, 2009 did u use any constants file in the script u dont get the error , probably it was included already.. Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet
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