SevenScript Posted February 18 Share Posted February 18 Hello, 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 sleep(50) send("FirstPulse") EndFunc Func functions() ;// Pressing F4 2nd time sleep(50) send("SecondPulse") EndFunc and 3rd time is again 1st, 4th -> 2nd Link to comment Share on other sites More sharing options...
SevenScript Posted February 18 Author Share Posted February 18 Okey, found other topic with Toggle explain and already have my answer HotKeySet('1', 'fc') Global $bIsDown = False Func fc() $bIsDown = Not $bIsDown If $bIsDown Then send("pulse1") Return EndIf send("pulse2") EndFunc While True Sleep(200) WEnd Link to comment Share on other sites More sharing options...
mistersquirrle Posted February 18 Share Posted February 18 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 Sleep(10) WEnd 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) EndSwitch $iCount += 1 If $iCount >= $iCountMax Then ; You can reset your count when you've reached your specified max $iCount = 0 EndIf Return $iCount EndFunc SevenScript 1 We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now