Last active
December 3, 2018 12:34
-
-
Save MvRens/36343780fb9a0d66870f025ea80c5a11 to your computer and use it in GitHub Desktop.
KeePassXC Ctrl-Alt-K global shortcut to open
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
/* | |
Ctrl-Alt-K - open KeePassXC | |
- Assumes single instance mode (it simply starts up KeePassXC). | |
- Waits for up to 5 seconds until the window is visible. | |
- Brings it to the foreground. As of KeePassXC 2.3.3 it does not always do this | |
itself when launched again. Haven't tested 2.3.4 since it has an issue with | |
URL scheme matching disabled. | |
- If succesful, presses Ctrl-F to focus the search box. | |
*/ | |
^!K:: | |
Run, "C:\Program Files\KeePassXC\KeePassXC.exe" | |
kpxcWindowAttempts := 0 | |
Loop | |
{ | |
kpxcWindowID := WinExist("ahk_exe KeePassXC.exe") | |
if kpxcWindowID > 0 | |
{ | |
WinActivate % "ahk_id " . kpxcWindowID | |
IfWinActive % "ahk_id " . kpxcWindowID | |
Send % "^f" | |
Break | |
} | |
kpxcWindowAttempts := kpxcWindowAttempts + 1 | |
if kpxcWindowAttempts > 50 | |
Break | |
Sleep, 100 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment