Created
January 30, 2017 14:02
-
-
Save mkropat/6204b96e21d60b8b31377386d3947571 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^!r::Reload | |
RunOrRaise(caption) { | |
r := ComObjGet("winmgmts:") | |
.ExecQuery("SELECT Handle FROM Win32_Process WHERE Caption='" . caption . "'") | |
If r._NewEnum()[proc] | |
{ | |
;WinGet, windows, list | |
;Loop, %windows% | |
;{ | |
; id := windows%A_Index% | |
; WinGet pid, PID, % "ahk_id " id | |
; If (proc.Handle = pid) | |
; { | |
; WinActivate, ahk_id %id% | |
; Return | |
; } | |
;} | |
pid := proc.Handle | |
WinActivate, ahk_pid %pid% | |
} | |
Else | |
{ | |
Run, %caption% | |
} | |
r := "" | |
} | |
^!c::RunOrRaise("chrome.exe") | |
^!f::RunOrRaise("firefox.exe") | |
^!g::RunOrRaise("gvim.exe") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment