Jump to content

HotKeySet() and Send() keyboard map f**kup


Recommended Posts

Hi!

If i execute insert() by the Hotkey (Ctrl+B ) it fuck up the whole keyboard map, buttons send mouse clicks and so. (Ctrl+C fix it but its not acceptable for my purposes {Send(^c) doesn't fix the problem btw})

HotKeySet("^b", "insert")
func insert()
Send("kurva anyad bbd dsa")
endfunc
while 1
sleep(100)
wend

It only occur if there is a "b" character in the string, i guess it retrigger the HotKeySet. So i tried to temporary disable the hotkeyset like this:

HotKeySet("^b", "insert")
func insert()
HotKeySet("^b") ;unset
Send("kurva anyad bbd dsa")
HotKeySet("^b", "insert") ;reset
endfunc
while 1
sleep(100)
wend

Still no luck :mellow:

Edited by Lazarushun
Link to comment
Share on other sites

I've had a similar problem. but unfortunately cannot remember how I solved it.

If my memory serves it was something to do with sticky keys, it might have been a solution to send an extra ctrlup key, but cannot be certain.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I've had a similar problem. but unfortunately cannot remember how I solved it.

If my memory serves it was something to do with sticky keys, it might have been a solution to send an extra ctrlup key, but cannot be certain.

True, Ctrl itself fixes it. But i cannot make it work with Send(). Tried "{LCTRL}{RCTRL}{CTRL}^".

Maybe try with _IsPressed($Key) function?

Look here.

Thanks, but i need a button combination :/ It's way too hard to push both of them in the same microsecond :mellow: It would be possible with an _IsKeyDown() like function. Edited by Lazarushun
Link to comment
Share on other sites

yes :/

HotKeySet("^b", "insert")
func insert()
HotKeySet("^b") ;unset
Send("kurva anyad bbd dsa")
sleep(800) ; wait for real Ctrl up
Send("^{LCTRL}{RCTRL}{CTRL}{CTRLUP}") ; simulate Ctrl
HotKeySet("^b", "insert") ;reset
endfunc
while 1
sleep(100)
wend

Same problem

Link to comment
Share on other sites

Did you try something like

#Include <Misc.au3>
While 1
 Sleep(10)
 If _IsPressed("11") And _IsPressed("42") Then
  insert()
 EndIf
WEnd
Func insert()
 Send("it worked")
EndFunc   ;==>insert

I tried and it worked. The only thing is as long as those 2 keys are pressed it will keep sending, but they don't need to be pressed at the exact same time just as long as at some point they are down together.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I've solved the 'stuck key' issue, well, my 'stuck key' issue, with code like this

Send("{CTRLDOWN}")

Sleep(10)

Send("{CTRLUP}")

The issue came about due to my script waiting for a manual ctrl-c

If ClipGet() <> "" Then

and one of the things after it had to do then was Send("{TAB}")

Because the Send function saw the ctrl key still being held down, the 'stuck key' issue arose. The 'stuck key' was the ctrl key.

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

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

×
×
  • Create New...