Sign in to follow this  
Followers 0
d00dness

Un-Registering HotKeySet

6 posts in this topic

Ok so I've figured out 99% of my script and now there's only 1 thing missing ... how to un-register the F7 key I have set.. Now i've googled and searched the forums and yes it said on the forums to leave it blank ....

HotKeySet("{F4}", "_StartBuffs")
HotKeySet("{F5}", "_Pause")
HotKeySet("{F6}", "_Exit")
HotKeySet("{F7}", "_Attacks1")
HotKeySet("{F7}"  )

But when I go to run the script... and I hit F7 nothing happens.... the _Attacks1 function does not fire off. Now if I ";" out the HotKeySet("{F7}" ) the script works....... so what am I doing wrong? I want to be able to 'turn on and turn off' the _Attacks1 function.... Tks in advance....

Share this post


Link to post
Share on other sites



HotKeySet("{F7}" )

this is correct for unregistering the hotkey.

You are however calling it right after you declared the hotkey.... so the user probably had a couple milliseconds where he could have used F7, but to call it the way you want, you only want to use that unregister line when you no longer want it to be linked to a function.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Do:

HotKeySet("{F4}")
HotKeySet("{F5}")
HotKeySet("{F6}")
HotKeySet("{F7}")
That makes is so that no functions is called when the key is pressed... And then to turn them back on just use your code...

Edit: and in the code you posted you disabled F7 right after you enabled it... Which is why it's not working...

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Thanks guys.. I guess being a n00b .. I declare all my hotkeys in the very begining of my scripts...... which because I never had to 'turn on / off' a hotkey before, they've always worked... In this script, the F7 key fires off the attack mode:

Func _Attacks1()
    While 1
    Dim $array[6] = ['8', '7', '6', '5', '4', '3' ]
    For $X = 0 To UBound($array) - 1
        ControlSend($Title, "", "", $array[$X])
        Sleep(2000)
    Next
    WEnd
EndFunc  ;==>_Attacks1

This probally makes sense why I had it setup at the front of the script... so i guess i'll declare the 'off' hotkeys first and then the one's I created? Thanks again for the quick response... I apprecaite it...

Share this post


Link to post
Share on other sites

Thanks guys.. I guess being a n00b .. I declare all my hotkeys in the very begining of my scripts...... which because I never had to 'turn on / off' a hotkey before, they've always worked... In this script, the F7 key fires off the attack mode:

Func _Attacks1()
    While 1
    Dim $array[6] = ['8', '7', '6', '5', '4', '3' ]
    For $X = 0 To UBound($array) - 1
        ControlSend($Title, "", "", $array[$X])
        Sleep(2000)
    Next
    WEnd
EndFunc ;==>_Attacks1

This probally makes sense why I had it setup at the front of the script... so i guess i'll declare the 'off' hotkeys first and then the one's I created? Thanks again for the quick response... I apprecaite it...

I'm not sure if I'm understanding you right but let me explain a bit about hotkeys... There is no "on or off" in the way I think you're understanding it. Either it's assigned a function or not, and if it's not it will type the key like normal. Therefore, there is no point in putting your "off" hotkeys at the top... rather you should just assign them to functions when you need to.

If that didn't make sense just ask about what you don't get...


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

I'm not sure if I'm understanding you right but let me explain a bit about hotkeys... There is no "on or off" in the way I think you're understanding it. Either it's assigned a function or not, and if it's not it will type the key like normal. Therefore, there is no point in putting your "off" hotkeys at the top... rather you should just assign them to functions when you need to.

If that didn't make sense just ask about what you don't get...

Piano - No that makes sense... I guess the reason I thought there was a 'on / off ' function of the hotkeys, is because in my script I have a 'paused' function assigned to F6... and when I hit F6 it pauses the script.. When i hit F6 again, it unpauses the script.. so I thought if the pause hotkey could do that, why not any other function.... like my attacks... I don't want them to continously be active but would rather hit a Fkey when needed .. hence the 'turn on / off' concept.. Hopefully I made sense this time :D .. tks ..

Share this post


Link to post
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
Sign in to follow this  
Followers 0