gottygolly Posted December 13, 2019 Posted December 13, 2019 (edited) Kind of odd what's going on When I press Left Ctrl -_Ispressed("A2")- my computer thinks the key is being held down causing a bunch of problems for me. Even when I stop the script my computer thinks the key is held down. What's even odder is I set it up to count how many times it detected the key being pressed and it would stop then, it only messes up when I try to add a Send or anything else to it. I have tried it with a lot of other keys as well and they all gave the same problem, I also checked sticky keys and they are all turned off. Thank you in advance for any tips or suggestions! Friendly note: If you decide to run the code below it will make your system act odd, a simple fix is to press "Ctrl + Alt + Del" and then cancel. It fixes whatever is causing the problem. #include <Misc.au3> $gui = GUICreate("Auto Typer",300,120,-1,-1) Opt("GUIOnEventMode",1) GUISetOnEvent(-3,"_Exit") $text = GUICtrlCreateInput("",5,5,290,20) GUICtrlSetState($text,1) Global $stunt = False, $p = 0 $send = GUICtrlCreateCheckbox("Send",5,50,100,20) GUISetState() While 1 If _IsPressed("A2") Then If GUICtrlRead($send) = 4 Then $p += 1 GUICtrlSetData($text,$p) EndIf $stunt = True EndIf If $stunt = True And GUICtrlRead($send) = 1 Then Send("Hi") $stunt = False EndIf Sleep(10) WEnd Func _Exit() Exit EndFunc Edited December 13, 2019 by gottygolly
Nine Posted December 13, 2019 Posted December 13, 2019 https://www.autoitscript.com/wiki/FAQ#Why_does_the_Ctrl_key_get_stuck_down_after_I_run_my_script.3F Maybe this will explain... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
gottygolly Posted December 13, 2019 Author Posted December 13, 2019 Appreciate it I figured out a solution that works, I added another _IsPressed() that waits till it's no longer pressed then it calls the function #include <Misc.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> $gui = GUICreate("Example [Sent: 0]",300,120,-1,-1) Opt("GUIOnEventMode",1) GUISetOnEvent(-3,"_Exit") $text = GUICtrlCreateInput("",5,5,290,20) GUICtrlSendMsg($text,$EM_SETCUEBANNER,False,"Press Left Control To Send Text") $invis = GUICtrlCreateLabel("",-50,-50,0,0) GUICtrlSetState($invis,$GUI_FOCUS) $Counter = 0 GUISetState() While 1 If _IsPressed("A2") Then While _IsPressed("A2") Sleep(10) WEnd $Counter += 1 WinSetTitle($gui,"","Example [Sent: "&$Counter&"]") Send("Beep Bop - ") EndIf Sleep(10) WEnd Func _Exit() Exit EndFunc
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