Advertisement
somdcomputerguy

AutoGAT+

Oct 22nd, 2023 (edited)
2,068
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.58 KB | Source Code | 0 0
  1. Opt("TrayMenuMode", 3)
  2.  
  3. Local $SleepTime   = 100
  4. Local $helpURL     = "https://keepass.info/help/base/index.html"
  5. Local $KeePass[2]  = ["C:\Program Files\KeePass Password Safe 2\", "KeePass.exe"]
  6. Local $AutoType[3] = ["-auto-type", "-auto-type-password", "-auto-type-selected"]
  7.  
  8. Local $idKP   = TrayCreateItem("KeePass")
  9. Local $idKPH  = TrayCreateItem("KeePass Help")
  10.  TrayCreateItem("")
  11. Local $idAT   = TrayCreateItem("AutoType Selected")
  12. Local $idGAT  = TrayCreateItem("Global AutoType")
  13. Local $idGATP = TrayCreateItem("Global PassWord")
  14.  TrayCreateItem("")
  15. Local $idExit = TrayCreateItem("Exit")
  16.  
  17. If $CmdLine[0] > 1 Then
  18.  For $i = 1 to $CmdLine[0]
  19.   Switch $CmdLine[$i]
  20.    Case '-delay'
  21.     $SleepTime  = $CmdLine[$i + 1]
  22.    Case '-path'
  23.     $KeePass[0] = $CmdLine[$i + 1]
  24.    Case '-name'
  25.     $KeePass[1] = $CmdLine[$i + 1]
  26.   EndSwitch
  27.  Next
  28. EndIf
  29.  
  30. TraySetState(1)
  31. TraySetIcon(@ScriptDir & '\AutoGAT.ico')
  32.  
  33. While 1
  34.     If Not ProcessExists($KeePass[1]) Then ExitLoop ;leaves this While loop if KeePass exits or isn't running
  35.     Switch TrayGetMsg()
  36.         Case $idExit
  37.             Exit
  38.         Case $idKP
  39.             ShellExecute($KeePass[0] & $KeePass[1])
  40.         Case $idKPH
  41.             ShellExecute($helpURL)
  42.         Case $idAT
  43.             Send("!{TAB}")
  44.             Sleep($SleepTime)
  45.             ShellExecute($KeePass[0] & $KeePass[1], $AutoType[2])
  46.         Case $idGAT
  47.             Send("!{TAB}")
  48.             Sleep($SleepTime)
  49.             ShellExecute($KeePass[0] & $KeePass[1], $AutoType[0])
  50.         Case $idGATP
  51.             Send("!{TAB}")
  52.             Sleep($SleepTime)
  53.             ShellExecute($KeePass[0] & $KeePass[1], $AutoType[1])
  54.     EndSwitch
  55. WEnd
  56.  
  57. Exit
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement