Isso não é algo que você pode fazer facilmente.
Você pode fazer algo como: link
Ou você pode modificar seu arquivo em tempo de execução e recarregá-lo.
#SingleInstance Force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^!n::
WinGet, pn, ProcessName, A
path := GetProcessPath(pn)
tooltip, press a new hotkey
Input, new_hotkey, L1
tooltip,
code = ^!%new_hotkey%':':Run, %path%'n
FileAppend, %code%, %A_ScriptFullPath%
Reload
Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing?
IfMsgBox, Yes, Edit
return
GetProcessPath(exe) {
;;http://www.autohotkey.com/board/topic/32965-getting-file-path-of-a-running-process/
for process in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process where name ='" exe "'")
return process.ExecutablePath
}
return
Hotkeys:
^!f::Run, C:\Program Files\Mozilla Firefox\firefox.exe