; FileDelete, %A_Desktop%\my running scripts.ini
; Get a list of all running AHK scripts:
DetectHiddenWindows, ON
WinGet, id, list, ahk_class AutoHotkey
Loop, %id% ; retrieves the ID of the specified windows, one at a time
{
this_ID := id%A_Index%
WinGetTitle, title, ahk_id %this_ID%
SkriptPath := RegExReplace(title, " - AutoHotkey v" A_AhkVersion )
If InStr(SkriptPath, A_ScriptFullPath)
continue
; Store the path of each running script in an INI-file and terminate it:
IniWrite, %SkriptPath%'n, %A_Desktop%\my running scripts.ini, my_running_scripts
WinClose, %SkriptPath% ahk_class AutoHotkey
}
; Run %A_Desktop%\my running scripts.ini
; Create a new script in the startup folder that starts the same scripts after rebooting:
FileAppend,
(
IniRead, my_running_scripts, '%A_Desktop'%\my running scripts.ini, my_running_scripts
Loop, parse, my_running_scripts, ''n
Run '%A_LoopField'%
; FileDelete, '%A_ScriptFullPath'%
ExitApp
)
, %A_Startup%\my running scripts.ahk
ExitApp
return
Substitua %A_Startup%
por %A_Desktop%
se você quiser reiniciar os scripts manualmente na sua área de trabalho.