boji Posted May 9, 2008 Share Posted May 9, 2008 When I hotkey a macro with say, alt+n for example, it appears after the program executes, the alt key gets stuck in the down position. any history with an issue like this? I've tried using blockinput and variations on sleep and send("{altup}") at the end of the program, but it still sometimes gets hung. Is there a way for autoit to "see" if a key is in the down positon and correct it? or, can you reset the keyboard in some way after a prog executes? Thank you for your help. Link to comment Share on other sites More sharing options...
philw Posted May 9, 2008 Share Posted May 9, 2008 (edited) When I hotkey a macro with say, alt+n for example, it appears after the program executes, the alt key gets stuck in the down position. any history with an issue like this?I've tried using blockinput and variations on sleep and send("{altup}") at the end of the program, but it still sometimes gets hung.Is there a way for autoit to "see" if a key is in the down positon and correct it? or, can you reset the keyboard in some way after a prog executes? Thank you for your help.I had exactly the same thing happen to me when using a hotkey to trigger a macro. See here for martin's explanation of what causes the problem. Edited May 9, 2008 by philw Link to comment Share on other sites More sharing options...
boji Posted May 12, 2008 Author Share Posted May 12, 2008 Is there a way for autoit to tell when a key has been released? Not _IsPressed but something like _IsReleased would fix the hotkey keystuck problem. Martin's explanation makes good sense, and what he provides as a solution is well recieved, however having a window pop up everytime a person holds alt or shift or delete too long seems like more of a bandaid than a solution. Martins solution: Func _SendEx($ss) Local $iT = TimerInit() While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12") If TimerDiff($iT) > 100 Then MsgBox(262144, "Warning", "Shift, Ctrl and Alt Keys need to be released to proceed!") EndIf WEnd Send($ss) EndFunc ;==>_SendEx Link to comment Share on other sites More sharing options...
boji Posted May 12, 2008 Author Share Posted May 12, 2008 (edited) Sorry for my ignorance. It seems with some correct placment of Func while_button() While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12") Sleep(300) WEnd EndFunc Solves the problem nicely. HotKeySet("^d", "Pastedate") Func pastedate() while_button() run(@ProgramFilesDir & "\Unison Tools\Paste Today Date.exe") EndFunc Paste Today Date.exe is: #include <Date.au3> #include <Misc.au3> _Singleton(@ScriptFullPath) AdlibEnable("Terminate",3000) WinSetState("", "", @SW_ENABLE) $date = StringSplit(_NowDate(), "") For $I = 1 To Ubound($date)-1 Sleep(5) Send($date[$I]) Next Sleep(50) Exit Func Terminate() Exit EndFunc Edited May 12, 2008 by boji Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now