diff options
author | John Ankarström <john@ankarstrom.se> | 2021-02-05 12:42:06 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-02-05 12:42:06 +0100 |
commit | 51c0cd271065867b9dc04f16a1808eefb7733d82 (patch) | |
tree | 16e3728d45fa49e103aea50be37d7a4880841210 /tt.jump.ahk | |
parent | 05a998c59034bfe9e1655913dd71a74c41c5f208 (diff) | |
download | ahk-51c0cd271065867b9dc04f16a1808eefb7733d82.tar.gz |
jump: Open in existing window if already open, fix Win key issues
Diffstat (limited to 'tt.jump.ahk')
-rw-r--r-- | tt.jump.ahk | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tt.jump.ahk b/tt.jump.ahk index aa5232f..f1e62c1 100644 --- a/tt.jump.ahk +++ b/tt.jump.ahk @@ -15,20 +15,15 @@ JumpPaths := { s: env("Sync") #s:: ToolTip, ... -SendInput, {Blind}{LWin Up}{RWin Up} -Input, k, C L1 +Input, k, M C L1 if (JumpPaths[k] != "") { if (InStr(FileExist(JumpPaths[k]), "D")) - Run, % "explorer /n, """ JumpPaths[k] """" + OpenExplorer(JumpPaths[k]) else Run, % """" JumpPaths[k] """" } ToolTip -if (GetKeyState("LWin", "P")) - SendInput, {Blind}{LWin Down} -if (GetKeyState("RWin", "P")) - SendInput, {Blind}{RWin Down} return ;; -> library @@ -38,3 +33,14 @@ env(name) EnvGet, r, %name% return r } + +OpenExplorer(path) +{ + for window in ComObjCreate("Shell.Application").Windows { + if (window.Document.Folder.Self.path = path) { + WinActivate, % "ahk_id " window.hwnd + return + } + } + Run, % "explorer /n, """ path """" +} |