Simple hotkey not working in KeePass

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
freespacing
Posts: 150
Joined: 28 Sep 2016, 11:14
Contact:

Simple hotkey not working in KeePass

22 Nov 2017, 21:00

I am trying to create simple hotkeys to make it easier to use the KeePass interface. For Options, it is Alt t, then either o or down arrow six times.

The Alt + t works, but then the second part of the hotkey fails: o is not pressed, or the arrows do not work.
I have hotkeys for about twenty programs, and I've never had this situation.
Would anyone have any hints of what might be happening? Something special about KeePass defending itself against automation?

Thanks!

Not working #1

Code: Select all

#IfWinActive ahk_exe KeePass.exe 
F12::  ; Preferences
  !t
  Sleep 500
  Send o
Return
#IfWinActive
Not working #2

Code: Select all

#IfWinActive ahk_exe KeePass.exe 
F12::  ; Preferences
   !t
   Sleep 500
   GoDown(6) ; This function works for other hotkeys. Down arrow 6 times.
   Send {Enter}
Return
#IfWinActive
A_AhkUser
Posts: 1147
Joined: 06 Mar 2017, 16:18
Location: France
Contact:

Re: Simple hotkey not working in KeePass

22 Nov 2017, 23:26

Hi freespacing,

Try put a:

Code: Select all

SendMode, Input
on the Auto-execute Section of your script (the Top of the script). Actually:
SendInput is generally the preferred method to send keystrokes and mouse clicks because of its superior speed and reliability. Under most conditions, SendInput is nearly instantaneous, even when sending long strings.
source: SendInput details

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
#SingleInstance, force
SendMode, Input


#IfWinActive ahk_exe KeePass.exe 
F12::
   send {Alt down}t{Alt Up}
   sleep 500
   goDown(6)
   send {Enter}
return
#IfWinActive

godown(__n) {
send % "{Down " . __n . "}"
}
my scripts
freespacing
Posts: 150
Joined: 28 Sep 2016, 11:14
Contact:

Re: Simple hotkey not working in KeePass

22 Nov 2017, 23:55

Thank you so much, @A_AhkUser

I already hadSendMode Input, but you nailed it with {Alt down}t{Alt Up}

Why do I always forget about that?

Thank you so much for your help!
:dance:

Working Fragment

Code: Select all

; -------------- Hotkeys for KeePass -----------------
#IfWinActive ahk_exe KeePass.exe 

F12::  ; Preferences
 Send {Alt down}t{Alt Up}
 Sleep 50
 Send o
 Return

#IfWinActive
; -------------- End hotkeys for KeePass -----------------

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 306 guests