Jump to content

1 Hotkey for 2 keys in pulse one-after-one

Recommended Posts


Looking for soultion,

want to prepare 1  Hotkey with 2 different options which would work one after one.


For example


HotKeySet('{F4}', 'functions')

Func functions()  ;// Pressing F4 1st time


Func functions()  ;// Pressing F4 2nd time



and 3rd time is again 1st, 

4th -> 2nd 

Link to comment
Share on other sites

Here's a way for you to do sequential actions through a single hotkey, expandable to more than just 2 options:

HotKeySet('\', 'fc') ; Keep in mind that Send can trigger hotkeys, so using '1' is a bad idea if you're Sending a 1 in your function

While True

Func fc()
    Local Static $iCount = 0
    Local Const $iCountMax = 5

    Switch $iCount
        Case 0 ; Keep in mind if you're starting at 0 or 1, and what you reset it to
            Send('Pulse 1')
        Case 1
            Send('Pulse 2')
        Case 2
            Send('Pulse 3')
        Case 3
            Send('Pulse 4')
        Case 4
            Send('Pulse 5')
        Case Else
            ConsoleWrite('Unregistered count/action: ' & $iCount & @CRLF)

    $iCount += 1
    If $iCount >= $iCountMax Then ; You can reset your count when you've reached your specified max
        $iCount = 0

    Return $iCount


We ought not to misbehave, but we should look as though we could.

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

  • Recently Browsing   0 members

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