houseonfire Posted July 12, 2011 Posted July 12, 2011 (edited) How would I go about making this script stop by clicking the same button that activated it? I figured i needed multithreading, so Iv been trying to use this here: But I'm not getting too far. Thanks I guess I don't understand how to use the multithreading maybe, or maybe I'm just doing it wrong. Can someone please help me out? Thanks Edited July 13, 2011 by houseonfire
AdmiralAlkex Posted July 12, 2011 Posted July 12, 2011 You don't need or want multi-threading.There are lots of ways to do this, some are explained in the Interrupting a running function-tutorial in the wiki, so I suggest you start there. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
somdcomputerguy Posted July 12, 2011 Posted July 12, 2011 Another way to do this is like this, although I'd suggest going thru that tutorial as well. #include <GuiConstantsEx.au3> Opt("MustDeclareVars", 1) Local $GUI, $Button $GUI = GUICreate("one button - two things") $Button = GUICtrlCreateButton(" Start ", -1, -1) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button DoSomething() EndSwitch Sleep(10) WEnd Func DoSomething() If ControlGetText("one button - two things", "", $Button) = " Start " Then ControlSetText("one button - two things", "", $Button, " Stop ") MsgBox(0, "", "The script has started doing something") Else ControlSetText("one button - two things", "", $Button, " Start ") MsgBox(0, "", "The script has stopped doing something") EndIf EndFunc - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
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