Jump to content

HotKey Function - *facepalm* fail


Recommended Posts

For some screwy reason, the pause and exit hotkeys work fine, but the others don't.

I'm sure its just something stupid I'm doing wrong, and I've tried to shrink my code to make it less time-consuming to review. (Also as part of my troubleshooting process)

At this point, I'm sure some fresh eyes can give me a nice quick smack in the face. :mellow:

Global $gloPAUSE = False

HotKeySet("`", "TogglePause")
HotKeySet("{ESC}", "Terminate")

HotKeySet("{LCTRL}1", "Trigger1")
HotKeySet("{LCTRL}2", "Trigger(2)")

While 1
    sleep(100)
WEnd

Func Trigger1()
    MsgBox("ONE", "test", "well it got to 1")
    sleep(1000)
EndFunc

Func Trigger($x)
    MsgBox("TWO", "test", "it got to 2!")
    Sleep(1000)
EndFunc

Func TogglePause()
    $gloPAUSE = NOT $gloPAUSE
    if $gloPAUSE Then
        ToolTip('Script Paused',0,0)
    Sleep(1000)
    ToolTip("")
    Else
    ToolTip('Script Enabled',0,0)
    sleep(1000)
    ToolTip("")
    EndIf
EndFunc

Func Terminate()
    Exit 0
EndFunc
Link to comment
Share on other sites

Try '^1' and '^2' instead of '{LCTRL}1' and '{LCTRL}2'. Some of the keys in the send syntax cannot be set as hotkeys.

Mat

Thanks... I knew I just needed a swift kick. :mellow:

Wow, I could have sworn I already tried that.

The second function still doesn't work... well, I've learned the hard way that you can't pass args via HotKeys. Wonder why?

Link to comment
Share on other sites

Huh, thats interesting.

So I could effectively create Hotkey's which trigger function params.

Create a hotkey with a null handler (empty function)

Switch for last hotkey pressed -> trigger function.

Well... maybe. I'll toy around with it a bit and find out.

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...