ryukkO Posted October 6, 2012 Share Posted October 6, 2012 (edited) Hi, im trying to understand how to get my scripts in GUI and im geting a problem with the checkbox, its like this: to understand i create a simple loop i check the checkbox and the script opens a folder (the orange one, im portuguese im not shure whats the name of the folder in english) and i whant it to keep doing it until i uncheck it. when i uncheck the checkbox it does the same thing im having trouble with that i need help to make it stop when i uncheck it.. sorry for bad english and thanks in advance expandcollapse popup#include #include #include #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 179, 49, 192, 124) $Checkbox1 = GUICtrlCreateCheckbox("open folder", 16, 16, 73, 17) $Button1 = GUICtrlCreateButton("exit", 88, 16, 75, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 HotKeySet("p","stop") $msg = GUIGetMsg() if $msg = -3 then Exit if $msg = $button1 then close() if $msg = $Checkbox1 then open() WEnd func close() Exit EndFunc func open() while 1 $open = PixelSearch(187,107,600,600,0xDE843D) if isarray($open) Then MouseClick("left",$open[0],$open[1],2,2) EndIf WEnd EndFunc Func stop() Exit EndFunc Edited October 6, 2012 by ryukkO Link to comment Share on other sites More sharing options...
water Posted October 6, 2012 Share Posted October 6, 2012 (edited) When the Checkbox has been selected you have to read the status of the CheckBox.#include <GUIConstantsEx.au3> $Form1 = GUICreate("Form1", 179, 49, 192, 124) $Checkbox1 = GUICtrlCreateCheckbox("open folder", 16, 16, 73, 17) $Button1 = GUICtrlCreateButton("exit", 88, 16, 75, 17) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = -3 Or $msg = $Button1 Then Exit If $msg = $Checkbox1 Then If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then MsgBox(0, "", "Checkbox selected") EndIf WEnd Edited October 6, 2012 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ryukkO Posted October 6, 2012 Author Share Posted October 6, 2012 so i did that but it goes like this: I check and it does the thing is ment to do over and over again but when i uncheck it does not stop it does the same thing like when its checked. what i need to do is. check -> loop exmpl.(open a folder when it fund the pixel over and over again) uncheck -> sleep (do nothing just w8 until i check it again) #include #include #include #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 179, 49, 192, 124) $Checkbox1 = GUICtrlCreateCheckbox("open folder", 16, 16, 73, 17) $Button1 = GUICtrlCreateButton("exit", 88, 16, 75, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 HotKeySet("p","stop") $msg = GUIGetMsg() If $msg = -3 Or $msg = $Button1 Then Exit If $msg = $Checkbox1 Then If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then open() EndIf WEnd func stop() Exit EndFunc func open() while 1 $open = PixelSearch(187,107,600,600,0xDE843D) if isarray($open) Then MouseClick("left",$open[0],$open[1],2,2) EndIf WEnd EndFunc Link to comment Share on other sites More sharing options...
water Posted October 6, 2012 Share Posted October 6, 2012 Because you never exit the Wile/WEnd loop. Should look like: func open() while 1 $open = PixelSearch(187,107,600,600,0xDE843D) if isarray($open) Then MouseClick("left",$open[0],$open[1],2,2) ExitLoop EndIf WEnd EndFunc My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ryukkO Posted October 6, 2012 Author Share Posted October 6, 2012 i did that and its not what i whant, i only whant to stop the loop when i uncheck the checkbox. sorry if im explaining worn or its my bad english. example: i check the box and the mouse goes to all folders and opens them, over and over again. i uncheck and it stops does nothing what i deed whas: i check the box and the mouse goes to all folders and opens them, over and over again.i uncheck it and it does the same thing it does not stop. i cant see were is the error if its the windows while or the func. if i exit loop it only does 1 time the func and stops with the box checked Link to comment Share on other sites More sharing options...
water Posted October 6, 2012 Share Posted October 6, 2012 Then you have to use the GuiOnEvent mode. Because you have to check for user input (uncheck the box) in the While/WEnd loop in function open(). My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ryukkO Posted October 8, 2012 Author Share Posted October 8, 2012 can u make an example plz? Link to comment Share on other sites More sharing options...
water Posted October 8, 2012 Share Posted October 8, 2012 Can you please explain why you have to use PixelSearch and "FolderOpen" in one script? What do you try to achieve? Is it a real problem you want to solve or do you just try to learn AutoIt? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ryukkO Posted October 11, 2012 Author Share Posted October 11, 2012 im trying to learn autoIt i did that example only to make it simple. im trying to learn 1 thing at time and making a loop in a check box is somthing i simply cant figure it out =/ Link to comment Share on other sites More sharing options...
water Posted October 11, 2012 Share Posted October 11, 2012 To learn AutoIt I would suggest to use a real life problem. If you create one yourself you often make it overly complex.Have a look at the wiki where you can find a lot of tutorials with a lot of example code. Take one of this examples and adopt them to your environment. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ryukkO Posted October 11, 2012 Author Share Posted October 11, 2012 ok then i will do and thanks a lot for the help Link to comment Share on other sites More sharing options...
water Posted October 11, 2012 Share Posted October 11, 2012 Glad to be of service I hope I can help you with the next question. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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