Sign in to follow this  
Followers 0
waterdark

Send key down problem and WinActive problem too

12 posts in this topic

Hi all first, im new, well, Im using this nice program from long time, and i wanted to comment some problems.

First of all, maybe more than a problem, a feature resquest, its with Send key down, it can make problems with PC if i send a key down and close the script (by hand, by code or by error), when the script is closed, the key still down, and make that the PC dont work well, its seriues when the key donw are ALT, or CTRL or SPACE for example, so i was thinking about that will be good, if can be added in anyway, that when script close, he auto send release the keys that was down?

The problem with WinActive, and maybe with anything that work checking the windows name, is that, when you use it to mucht, usually make the PC crazy and some keys not working, for example, i have a script that use a lot the check of WinActive, and sometimes it make that the Windows key and F1 not work well, anyone had the same problem?

I have this problem from long, so from April 2010 version up to the last beta.

I use mosly Windows XP SP3.

Thx for the support and work, and so sorry for my creepy english :/

Share this post


Link to post
Share on other sites



For the "stuck" key problem look at this link to the Wiki.

The second problem I can't be of much help, I've never seen the problem, and I also don't use do much with WinActive.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

In some cases where a modifier key is stuck, physically pressing the modifier can fix it, making it unstuck. Use the _sendEx() linked by BrewManNH too.


I am not a lawyer.  (-_-) Xandy About  (^o^) Discord - Xandy Programmer

Share this post


Link to post
Share on other sites

Also, I would suggest looking into the Control commands, rather than Send. Send is notoriously problematic (as you're finding out), whereas the Control commands send the information you want directly to the window you want, and nothing more. You'll find it greatly shortens your script, as well as improving stability.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

For the "stuck" key problem look at this link to the Wiki.

The second problem I can't be of much help, I've never seen the problem, and I also don't use do much with WinActive.

THx, it can be usefull for start a script and check that nothing is pressed down, but it dont help to the PC user, the problem after end a script, and some key still pressed down :/, I try to add key released at the end of the script, but the problem come when the script dont end normally, like you close it or had a error. When this happend press the stuck key by hand, not work always, it work like 20% or less.... i remove it after begin crazy pressing lot of keys... :D

I tried the Control commands and it dont work with what i try.

I think, i will try to increase a bit sendkeydelay, and send all like send("{ALT down}a{ALT up}").

Share this post


Link to post
Share on other sites

THx, it can be usefull for start a script and check that nothing is pressed down, but it dont help to the PC user, the problem after end a script, and some key still pressed down :/, I try to add key released at the end of the script, but the problem come when the script dont end normally, like you close it or had a error.

So don't add the 'release key' snippet to the end of the script, but add it right after the Send.

Using ALT down and ALT up in place of the AutoIt modifier for ALT (!) probably won't make a difference here.

What error are you getting with ControlSend? Just "it don't work" doesn't help anybody help you. So basically, "it don't work", doesn't work.


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

Share this post


Link to post
Share on other sites

Did you read the information in the thread I linked? It will, in most cases, fix the issue you said you were having with "stuck" keys.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Did you read the information in the thread I linked? It will, in most cases, fix the issue you said you were having with "stuck" keys.

I did... maybe my autoit lvl is so low for undertand ,or my english... but what i undertand are that u need to run that script for fix the problem? my problem come with noone script is running, so the script closed by anything, and keys still stuck, so when want to use the PC, it make crazy things..

I wanted to press down one time and do all need to do because is faster than press down and release in every send... also, there was some errors, like its so fast that send the key before press down... but i fixed it increasing the send delay option from 5ms to 20ms.

The problem with command control is that the application dont accept it.. well, i send, and do nothing, but i will check it again, because sure i did something wrong :D,anyway doing what i said dont work bad "send("{ALT down}a{ALT up}")." and increase delay, only that i wanted to be faster.

And about WinActive, it happend me 10min ago, and what it do is, press down ALT, the script that i was using, dont have anywhere to press ALT, but when i tried to use keyboard its worked like the ALT is down, well, keyboard and mouse...

THx for answer, i will check better the ControlSend when have time.

Share this post


Link to post
Share on other sites

You don't run it as a second script, you use the function _SendEx instead of Send to prevent your issue. If you don't know how to use functions, I'd suggest reading up on them and doing the tutorials.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

You don't run it as a second script, you use the function _SendEx instead of Send to prevent your issue. If you don't know how to use functions, I'd suggest reading up on them and doing the tutorials.

I undertand now... but you still not undertand me, the problem is not that ALT/CTRL or other key stay pressed when using a send, the problem is when the key remain pressed after script is closed, so when u try to write with your hand and keyboard, your PC do crazy things....

Anyway i will try ControlSend, i found how work it...

Share this post


Link to post
Share on other sites

YOU still don't understand, reread the wiki entry and you will see that using this PREVENTS the Alt/Ctrl keys from being stuck down, even after your script isn't running.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

WEll... or i dont undertand... or... dunno, i see that the check for see if the keys are pressed, are before the send command... do if the script dead before a new _SendEx and after the Send, theere no way he can prevent it???.. anyway, if i do how i said, send("{ALT down}a{ALT up}"), its hard to this happend... it happend when i do something like

send("{ALT down}")

stuff here

stuff here

more stuff here

send("{ALT up}")

that is how i was doing first

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