
AutoHotkey를 업데이트하려면 실행 중인 모든 스크립트를 닫아야 합니다. AutoHotkey 프로세스는 간단한 스크립트(아래 참조)로 종료할 수 있지만 동일한 스크립트를 마음대로 다시 시작하는 방법을 모르겠습니다. 현재 업데이트 후 컴퓨터를 다시 시작합니다(Windows 시작 폴더에서 AHK 스크립트를 실행하기 위해).
Windows에서는 여러 파일을 동시에 실행하는 것을 허용하지 않는 것 같습니다. 수십 개의 AutoHotkey 스크립트가 활성화되어 있기 때문에 수동으로 시작하는 것은 불가능합니다.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Loop
{
#Singleinstance force
Process, Close, Autohotkey.exe
}
답변1
; 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
데스크탑에서 스크립트를 수동으로 다시 시작하려면 %A_Startup%
다음으로 바꾸십시오 .%A_Desktop%