Informant Posted October 17, 2007 Share Posted October 17, 2007 (edited) I'm trying to make an auto-typer program but I just can't stop the typing. Here's what I currently got: expandcollapse popup#include <GuiConstants.au3> ; GUI GuiCreate("Auto-Typer", 330, 160) ; INPUT GuiCtrlCreateLabel("Text", 10, 10) $input = GuiCtrlCreateInput("", 45, 10, 200, 20) ; INPUT2 GuiCtrlCreateLabel("Every", 10, 50) $input2 = GuiCtrlCreateInput("1000", 45, 50, 100) GuiCtrlCreateLabel("Miliseconds", 150, 50) GUICtrlSetStyle ( $input2, $ES_NUMBER) ; INPUT3 GuiCtrlCreateLabel("Speed", 10, 80) $input3 = GUICtrlCreateInput("100", 45, 80) GUICtrlSetStyle ( $input3, $ES_NUMBER) ; START BUTTON $Button_1 = GuiCtrlCreateButton("Start", 10, 110, 100) GUICtrlSetState( $Button_1, $GUI_FOCUS) ; STOP BUTTON $Button_2 = GuiCtrlCreateButton("Stop", 110, 110, 100) ; EXIT BUTTON $Exit = GUICtrlCreateButton("Exit", 210, 110, 100) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Exit Exit Case $msg = $Button_1 Do $text = GUICtrlRead($input,1) $time = GUICtrlRead($input2,1) $speed = GUICtrlRead($input3,1) WinSetOnTop ("Auto-Typer", "", 1) WinActivate("Untitled") Opt("SendKeyDelay", $speed) Sleep( $time ) Send($text & "{ENTER}" ) Until $msg = $Button_2 EndSelect WEnd Edited October 17, 2007 by Informant Link to comment Share on other sites More sharing options...
Nahuel Posted October 17, 2007 Share Posted October 17, 2007 Here's the problem:Do ;... Until $msg = $Button_2Before the script enters the Do..Until loop, the value of $msg is $Button_1. Now, there's nothing inside the loop that changes that value, so the loop will go on for ever. So, adding $msg=GuiGetMsg() inside this loop should fix the problem. However, you have a Sleep() there that is going to cause some trouble. So I say you should look in the file for AdlibEnable(). This calls a specified function every X milliseconds. Link to comment Share on other sites More sharing options...
Informant Posted October 17, 2007 Author Share Posted October 17, 2007 Yea, it works perfectly now. Thank you very much, Nahuel! 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