tabnation

high low p2

Apr 19th, 2022 (edited)
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. ; v1 AHK
  2.  
  3. ; Settings
  4. #Persistent
  5. SetBatchLines, 5
  6. OnExit, ExitSub
  7. SetTimer, CheckActiveProcess, 10000
  8.  
  9. ; Variables
  10. global procIDList := Object()
  11. global wPID_old := ""
  12.  
  13. ; Routines
  14. R_GetProcessFullList()
  15. {
  16. procIDList := Object()
  17. procObj := ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process")
  18. for proc in procObj
  19. procIDList[proc.processId] := proc.Name
  20. }
  21. R_SetProcessPrio(pProcID, pState := "normal")
  22. {
  23. if (pProcID == "*") ; set given prio to all processes
  24. { for pID, pName in procIDList
  25. Process, Priority, % pID, % pState
  26. }
  27.  
  28. if (pProcID == "*others") ; set given prio to all other processes
  29. { for pID, pName in procIDList
  30. { if (pID != wPID_old)
  31. { Process, Priority, % pID, % pState
  32. }
  33. }
  34. }
  35.  
  36. else
  37. Process, Priority, % pProcID, % pState
  38. }
  39.  
  40. ; Program
  41. return
  42.  
  43. ; GoSubs / Timer
  44. CheckActiveProcess:
  45. WinGet, wPID, PID, A
  46. if (wPID != wPID_old)
  47. { R_SetProcessPrio(wPID,"High")
  48. wPID_old := wPID
  49. R_GetProcessFullList()
  50. R_SetProcessPrio("*others","Low")
  51. }
  52. return
  53.  
  54. ; Exit
  55. ExitSub:
  56. R_SetProcessPrio("*") ; set all processes to "normal"
  57. ExitApp
Add Comment
Please, Sign In to add comment