Guest User

Untitled

a guest
May 27th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. ; KeePassXC AutoIt3 Script to give the possibility to activate KeePassXC by HotKeySet
  2. ; Currently tested with Win10 x64 and KeePassXC 2.3.3
  3. ; CTRL-ALT-k will toggle KeePassXC (if in tray)
  4. ; if KeePassXC is focused ESC Key will minimize it to Tray
  5. ;
  6. ; feel free to improve this script
  7. ; www.solariz.de
  8. ;
  9. #Include <GuiToolBar.au3>
  10. HotKeySet("^!k", "ShowKeePassXC") ; Ctrl-Alt-k
  11. HotKeySet("{Esc}", "captureEsc")
  12.  
  13. While 1
  14. Sleep(500)
  15. WEnd
  16.  
  17. func captureEsc()
  18. ; if KeePassXC is focused toggle window minimize
  19. if StringInStr(WinGetTitle("[ACTIVE]"),"KeePassXC") Then
  20. ShowKeePassXC()
  21. EndIf
  22. EndFunc
  23.  
  24. func ShowKeePassXC()
  25. $hSysTray = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Text:User Promoted Notification Area]');
  26. For $i = 1 To _GUICtrlToolbar_ButtonCount($hSystray)
  27. ; KeePassXC do not set a button text so we need to use some trick
  28. $sCurrent = _GUICtrlToolbar_GetButtonText($hSystray,$i)
  29.  
  30. if $sCurrent = "" Then
  31. $sCurrent = _GUICtrlToolbar_GetButtonBitmap($hSystray,$i)
  32. ;ConsoleWrite($i & ": " & $sCurrent & @CRLF)
  33. If $sCurrent = 13 Then
  34. _GUICtrlToolbar_ClickButton($hSystray, $i, "left")
  35. WinWaitActive("[CLASS:Qt5QWindowIcon]", "")
  36. send("^f")
  37. ExitLoop
  38. EndIf
  39. EndIf
  40. Next
  41. EndFunc
Add Comment
Please, Sign In to add comment