hl1202 Posted December 30, 2010 Share Posted December 30, 2010 Hi guys, i'm new to AutoIt. I'm trying to write a program with 2 button: 1 start and one stop. I have a parameter $i = 0. If i > -1 then the Start function will repeat again and again. If i = -1 then it should stop. My start function worked perfectly. However, i couldn't make it stop. Here my code expandcollapse popup#include <GUIConstantsEx.au3> Opt("GUIOnEventMode",1) GUICreate("Test", 100, 100) $startButton = GUICtrlCreateButton("Start", 30,30) GUICtrlSetOnEvent($startButton,"StartClick") GUISetState(@SW_SHOW) $stopButton = GUICtrlCreateButton("Stop", 30,60) GUICtrlSetOnEvent($stopButton,"StopClick") GUISetOnEvent($GUI_EVENT_CLOSE,"CloseClick") Global $i = 0 While 1 Sleep(1000) WEnd Func StopClick() $i=-1 MsgBox(0, "", "Do you want to stop?") EndFunc Func CloseClick() Exit EndFunc Func StartClick() $title = WinGetHandle("Notepad","") while $i <> -1 WinActivate($title,"") ControlSend($title,"","","{ENTER}") ControlSend($title,"","","Test") ControlSend($title,"","","{ENTER}") Sleep(5000) WEnd EndFunc Link to comment Share on other sites More sharing options...
Zedna Posted December 30, 2010 Share Posted December 30, 2010 Look here Resources UDF ResourcesEx UDF AutoIt Forum Search 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