Sign in to follow this  
Followers 0
Alchemist

HotKeySet function

8 posts in this topic

hi all

HotKeySet("!0","testfunc")
HotKeySet("!1","ExitProgram")

while 1
sleep(100)
WEnd    

func testfunc()
    send("abcdef")
EndFunc

Func ExitProgram()
    Exit
EndFunc

Run this script.

Open notepad for example. Press quickly several times Alt+0.

After that Alt key remains held down sometimes.

Any ideas?

Share this post


Link to post
Share on other sites



Actually, I've had this kind of thing happen w/o spamming the function.

I have a function that grabs the selection via the clipboard and occasionally the Ctrl key will get stuck. Interestingly enough, calling the function directly rather than by HotKey does not exhibit this behavior.


#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post


Link to post
Share on other sites

Actually, I've had this kind of thing happen w/o spamming the function.

I have a function that grabs the selection via the clipboard and occasionally the Ctrl key will get stuck. Interestingly enough, calling the function directly rather than by HotKey does not exhibit this behavior.

I have noticed this problem a couple of times, it is always from a function that has no return, and getting hammered by a spam etc...

I cant say why you are having your problems though sorry.


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

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

::shrugs::

It doesn't happen when called by my function (which is the only time it could cause any real damage), so it's been classed in my head as a low-priority bug.


#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post


Link to post
Share on other sites

::shrugs::

It doesn't happen when called by my function (which is the only time it could cause any real damage), so it's been classed in my head as a low-priority bug.

The problem is very well known. You have a hotkey which calls a function which uses Send. Send starts sending characters before the keys for the hotkey have been released and that screws up the state of the keys. One solution is to add something in the function called to wait untill the hot keys have been released.

It's in FAQ item 19.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Martin receives the ball, cuts past the defender and lobs one right into the middle of the FAQ: GoooOOOOOOooooOOOOOoooaaaaaAalll!

Seriously, how did I miss that?


#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post


Link to post
Share on other sites

Thanks martin

Thanks all

_SendEx function solves the problem.

The problem is very well known. You have a hotkey which calls a function which uses Send. Send starts sending characters before the keys for the hotkey have been released and that screws up the state of the keys. One solution is to add something in the function called to wait untill the hot keys have been released.

It's in FAQ item 19.

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