Page 1 of 1

[Solved] Puzzle with asterisk hotkey prefix

Posted: 22 Jun 2015, 10:08
by Randy31416
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.

Re: Puzzle with asterisk hotkey prefix

Posted: 23 Jun 2015, 00:10
by lexikos
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::.)

Re: [Solved] Puzzle with asterisk hotkey prefix

Posted: 23 Jun 2015, 10:16
by Randy31416
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.