gauss5546 Posted November 11, 2008 Share Posted November 11, 2008 I have looked through the Auto It help guide and forums quite a few times but I have a question that I cannot find an answer to. Is it possible to set a program to have an affinity for one core with Auto It? Visually the way to do this is to open the task manager, click the processes tab, right click on the process, click set affinity, check off which cpu(s) you want it to use. I am looking for a quick way through Auto It that I can change the affinity for a certain process. Link to comment Share on other sites More sharing options...
cppman Posted November 11, 2008 Share Posted November 11, 2008 Check out, _WinAPI_SetProcessAffinityMask. Miva OS Project Link to comment Share on other sites More sharing options...
rasim Posted November 11, 2008 Share Posted November 11, 2008 I have looked through the Auto It help guide and forums quite a few times but I have a question that I cannot find an answer to. Is it possible to set a program to have an affinity for one core with Auto It? Visually the way to do this is to open the task manager, click the processes tab, right click on the process, click set affinity, check off which cpu(s) you want it to use. I am looking for a quick way through Auto It that I can change the affinity for a certain process.Example: #include <WinAPI.au3> Global Const $PROCESS_ALL_ACCESS = 0x1F0FFF $sPID = Run("notepad.exe") $hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $sPID) $aRet = _WinAPI_GetProcessAffinityMask($hProc) MsgBox(0, "", $aRet[0] & @LF & _ $aRet[1] & @LF & _ $aRet[2] & @LF) ;_WinAPI_SetProcessAffinityMask($hProc, 0x01) ;Set affinity for 1-st core ;_WinAPI_SetProcessAffinityMask($hProc, 0x02) ;Set affinity for 2-nd core _WinAPI_SetProcessAffinityMask($hProc, 0x03) ;Set affinity for both cores _WinAPI_CloseHandle($hProc) Link to comment Share on other sites More sharing options...
gauss5546 Posted November 11, 2008 Author Share Posted November 11, 2008 Thanks! I had to edit that script a bit to get it to work correctly and this is what I got it to. CODE#include <WinAPI.au3> $sPID = Run("notepad.exe") $hProc = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $sPID) $aRet = _WinAPI_GetProcessAffinityMask($hProc) ;_WinAPI_SetProcessAffinityMask($hProc, 0x01) ;Set affinity for 1-st core ;_WinAPI_SetProcessAffinityMask($hProc, 0x02) ;Set affinity for 2-nd core _WinAPI_SetProcessAffinityMask($hProc, 0x03) ;Set affinity for both cores _WinAPI_CloseHandle($hProc) It works great now! 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