[Solved] Puzzle with asterisk hotkey prefix

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Randy31416
Posts: 58
Joined: 15 Jan 2014, 19:09

[Solved] Puzzle with asterisk hotkey prefix

22 Jun 2015, 10:08

In a huge script I have the lines

Code: Select all

  #IfWinActive, ahk_exe AnyTimer.exe
    LButton::
      OutputDebug, DID DOWN JUNK
      SendInput, {Blind}{LButton Down}
      Return
    LButton Up::
      OutputDebug, DID UPPE JUNK
      SendInput, {Blind}{LButton Up}
      Return
    #IfWinActive
and these work as expected. When, however, I add the asterisk prefix and make the script

Code: Select all

  #IfWinActive, ahk_exe AnyTimer.exe
    *LButton::
      OutputDebug, DID DOWN JUNK
      SendInput, {Blind}{LButton Down}
      Return
    *LButton Up::
      OutputDebug, DID UPPE JUNK
      SendInput, {Blind}{LButton Up}
      Return
    #IfWinActive
then I never see the the hotkeys fire (I never get debug output for the hotkeys) Finally, if I extract these lines and run them in a small script (having killed the huge script for testing), then the asterisk and non-asterisk versions both fire the hotkeys. Any idea why the asterisks do not work in the much (much) larger script (with huge piles of hotkeys)? Literally, simply adding or removing the asterisks is the only change required to show the difference.
Last edited by Randy31416 on 23 Jun 2015, 10:04, edited 1 time in total.
lexikos
Posts: 9621
Joined: 30 Sep 2013, 04:07
Contact:

Re: Puzzle with asterisk hotkey prefix

23 Jun 2015, 00:10

Do you have another LButton hotkey somewhere in the script? A hotkey without the asterisk will take precedence over any with the asterisk, unless you're holding modifier keys that the hotkey doesn't specify. (i.e. Ctrl+LButton will trigger *LButton:: but not LButton::.)
Randy31416
Posts: 58
Joined: 15 Jan 2014, 19:09

Re: [Solved] Puzzle with asterisk hotkey prefix

23 Jun 2015, 10:16

Ah, me, dumbness dumbness everywhere . . . .

I use a home-brew precompiler for AutoHotkey (it helps me to do various things more naturally for me). One thing it does is allow an asterisk to be used as a comment marker (like the semicolon in AutoHotkey) unless overridden for a specific line. The precompiler works.

Wish my brain did.

Mea maxima culpa.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk, Yincognito and 168 guests