Sending hotkeys to Adobe Acrobat Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
LeFunk
Posts: 86
Joined: 29 Aug 2016, 03:12

Sending hotkeys to Adobe Acrobat

Post by LeFunk » 22 May 2022, 14:49

Hello!

I'm trying to use hotkeys in Adobe Acrobat, but so far nothing works.
For example:

Code: Select all

SetTitleMatchMode 2
#IfWinActive, Adobe Acrobat
c::
MsgBox, Test
#IfWinActive
Does nothing. I wonder what's missing?

Thanks in advance!

User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: Sending hotkeys to Adobe Acrobat  Topic is solved

Post by mikeyww » 22 May 2022, 14:55

Save & reload your script. End the hotkey routine with :arrow: Return. Ensure that your target window is active before you trigger the hotkey. If needed, run Window Spy to see your WinTitle. Close other scripts. Test your posted script with no other code in the script. Ensure that the script is running (green "H" icon in the system tray).

LeFunk
Posts: 86
Joined: 29 Aug 2016, 03:12

Re: Sending hotkeys to Adobe Acrobat

Post by LeFunk » 23 May 2022, 06:37

Thank you! I had it other #IfWinActive instances in the same script, I guess something causes the interference.

User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: Sending hotkeys to Adobe Acrobat

Post by mikeyww » 23 May 2022, 06:49

Yes, either a conflicting context or improper use of auto-execute section.

Explained: #IfWinActive
The #IfWin directives are positional: they affect all hotkeys and hotstrings physically beneath them in the script. They are also mutually exclusive; that is, only the most recent one will be in effect. Title matching behaviour is determined by SetTitleMatchMode as set in the auto-execute section. If more than one variant is eligible to fire, only the one closest to the top of the script will fire. The exception to this is the global variant (the one with no #IfWin criteria): It always has the lowest precedence; therefore, it will fire only if no other variant is eligible (this exception does not apply to hotstrings).
A demonstration of multiple coding errors is below.

Code: Select all

MsgBox, 64, Game over, This is the end!
; ==== End of auto-execute section ====
#IfWinActive ahk_exe acrobat.exe
c::MsgBox, A tisket
SetTitleMatchMode 2        ; Unlabeled code following Return never executes
#IfWinActive Adobe Acrobat ; Does not apply if a previously defined context already matched
c::MsgBox, A tasket
#IfWinActive

Post Reply

Return to “Ask for Help (v1)”