; Most clever parts of this script copied from "IdleRun" by Skrommel (
https://www.donationcoder.com)
; ---------------------------
;#NoTrayIcon
#SingleInstance force
#Persistent
IfNotExist,Task Affinity.ini
{
msgbox, 48, Task Affinity - First launch?, Configuration file "Task Affinity.ini" not found!`n`nPlease edit and restart.
Fileappend,[settings]`n`nTask = newsleecher.exe`,lame.exe`,mp3gain.exe`,quickpar.exe`,hksfv.exe`n`nAffinity = 2`n`n`n`n; Affinity can be:`n; ----------------`n; 1 = first core`n; 2 = second core`n; ...,Task Affinity.ini
Run,Notepad "Task Affinity.ini"
ExitApp
}
TrayMenu:
Menu,Tray,NoStandard
Menu,Tray,Add,Configure,TrayConfigure
Menu,Tray,Add,Exit,TrayMenuExit
IniRead,Task,Task Affinity.ini,settings,Task
IniRead,Task_Affinity,Task Affinity.ini,settings,Affinity
SetTimer, Tasks, 1000
Return
TrayConfigure:
RunWait,Notepad "Task Affinity.ini"
Reload
Return
TrayMenuExit:
ExitApp
Tasks:
Loop,parse,Task,`,
{
Process,Exist,%A_LoopField%
if errorlevel <> 0
{
Affinity_pid:=ErrorLevel
Affinity_Process:=DllCall("OpenProcess","UInt",0x1F0FFF,"Int",false,"UInt",Affinity_pid)
DllCall("SetProcessAffinityMask","UInt",Affinity_Process,"UInt",Task_Affinity)
DllCall("CloseHandle","UInt",Affinity_Process)
}
}