Code: Select all
#Persistent
SetTimer, CheckGPUandWindow, 1000 ; check every 1000ms (1 second)
CheckGPUandWindow:
GPULoad := GetGPULoad()
if (GPULoad > 50) {
WinGet, activeWindowID, ID, A
WinGetPos, X, Y, Width, Height, ahk_id %activeWindowID%
if (X = 0 and Y = 0) {
SysGet, ScreenWidth, 0
SysGet, ScreenHeight, 1
if (Width = ScreenWidth and Height = ScreenHeight) {
; now close all AutoHotkey scripts
}
}
}
return
GetGPULoad() {
; code to get GPU load goes here
; return the GPU load as a percentage (0-100)
}