Jump to content

Hotkey issue


Srvjj
 Share

Recommended Posts

My problem is that I tried to use hotkeyset in a script where the hotkey can be spammed and not interrupt the function that the hotkey calls. Essentially I want to know if there is a way to make a function ignore hotkeys until its done executing its code. I looked around and found some replacement hotkey functions written by "Yashied" that seemed from the description to be able to do that but I tried it and wasn't able to use it as I intended. Also I herd there was such a thing as a "blocking" function that essentially did what I wanted but I couldnt find any material on how that would be applied.

Link to comment
Share on other sites

I'd disable any/all the hotkeys either before the function is called or make it the first thing the function does, then re-enable/reset them when the function returns or make it the last thing the function does.

nevermind, I went and reread your post..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

uhm how about turning the hotkey off when a function is running?

you ca do this by just setting HotKeySet("KEY")

Thanks it turned off the hot key successfully but now I haven't had any luck turning it back on, i tried putting in a while loop a check to see if the key needed to be reset and if so reset it but it didn't work. I need to be able to spam a key which will do some stuff and ignore hot keys while its doing stuff then turn the hot key back on so that it can be pressed again. Th code goes something like this

hotkeyset("{tab}", "FuncA")

FuncA()

hotkeyset("{tab}")

send some keys

wait a little while

send a mouse click

$okayresethotkey = 1

endfunc

while 1

if $okayresethotkey == 1

hotkeyset("{tab}", "FuncA")

$okayresethotkey = 0

endif

wend

Edited by Srvjj
Link to comment
Share on other sites

HotKeySet("{TAB}", "FuncA")

While 1
 Sleep(10)
WEnd

Func FuncA()
 HotKeySet("{TAB}")
 send some keys ; use the Send() function here
 wait a little while ; use the Sleep() function here 
 send a mouse click ; use the MouseClick()  function here
 HotKeySet("{TAB}", "FuncA")
EndFunc

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

HotKeySet("{TAB}", "FuncA")

While 1
 Sleep(10)
WEnd

Func FuncA()
 HotKeySet("{TAB}")
 send some keys ; use the Send() function here
 wait a little while ; use the Sleep() function here 
 send a mouse click ; use the MouseClick()  function here
 HotKeySet("{TAB}", "FuncA")
EndFunc

Awesome it worked like that, I was skeptical of it working like that because I tried to use Blockinput and Yashied's _hotkeyrelease at the beginning and end of the code like that and neither worked.
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...