stefionesco Posted October 21, 2014 Share Posted October 21, 2014 Hi, there I try to put together this script but I do something wrong and I can't understand where. Here is my script: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: #ce ---------------------------------------------------------------------------- #include <GUIConstants.au3> $windows = GUICreate("Title", 280, 110) GUICtrlCreateLabel ("Route", 30, 10) $Radio1 = GUICtrlCreateRadio("1", 30, 30, 100, 20) $Radio2 = GUICtrlCreateRadio("2", 30, 50, 100, 20) GUICtrlSetState($Radio1, $GUI_CHECKED) $startbutton = GUICtrlCreateButton("START", 150, 40, 85, 25) ; BUTTON $button_x = 745 $button_y = 720 ;LEFT BUTTON $left_button_x = 935 $left_button_y = 585 ;RIGHT BUTTON $right_button_x = 385 $right_button_y = 585 GUISetState(@SW_SHOW) #comments-start ---------------------------------------------------------------------------- While $action = $startbutton If $Radio1 = $GUI_CHECKED Then MouseClick ("", $button_x, $button_y) If $Radio2 = $GUI_CHECKED Then MouseClick ("", $button_x, $button_y) Sleep (2000) Then MouseClick ("", $right_button_x, $right_button_y) Sleep (2000) Then MouseClick ("", $button_x, $button_y) Sleep (2000) Then MouseClick ("", $left_button_x, $left_button_y) Sleep (2000) Sleep 5 minutes after all this Loop until ESC or EXIT #comments-end ---------------------------------------------------------------------------- HotKeySet("{ESC}", "_Terminate") Func _Terminate() Exit EndFunc While 1 $action = GUIGetMsg() If $action = $GUI_EVENT_CLOSE Then ExitLoop EndIf WEnd Can somebody help me? Thanks in advance Route script.au3 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 21, 2014 Moderators Share Posted October 21, 2014 It is difficult to troubleshoot for you when you just say "I did something wrong, somewhere". Can you please let us know what application/window you're trying to manipulate? What do you expect the script to do, and at what point is it failing? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
stefionesco Posted October 21, 2014 Author Share Posted October 21, 2014 I can't compile the script. I did something wrong with "while" when I try to activate the start button. The program must click on a refresh button on a windows, and there is 2 different windows that I must choose with Radio buttons. This when I click the start button, and then repeat after 5 minutes. I use hotkeys ESC for exit. In the comment part of the script must be all the information needed, but I can't put it together. Link to comment Share on other sites More sharing options...
kylomas Posted October 22, 2014 Share Posted October 22, 2014 Your script compiles just fine for me. The bad news is that your script doesn't do anything except wait for a $GUI_EVENT_CLOSE action. If you are looking for an action from your start button then you have to check for it. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
stefionesco Posted October 22, 2014 Author Share Posted October 22, 2014 expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: #ce ---------------------------------------------------------------------------- #include <GUIConstants.au3> $windows = GUICreate("Title", 280, 110) GUICtrlCreateLabel ("Route", 30, 10) $Radio1 = GUICtrlCreateRadio("1", 30, 30, 100, 20) $Radio2 = GUICtrlCreateRadio("2", 30, 50, 100, 20) GUICtrlSetState($Radio1, $GUI_CHECKED) $startbutton = GUICtrlCreateButton("START", 150, 40, 85, 25) ; BUTTON $button_x = 745 $button_y = 720 ;LEFT BUTTON $left_button_x = 935 $left_button_y = 585 ;RIGHT BUTTON $right_button_x = 385 $right_button_y = 585 GUISetState(@SW_SHOW) While $action = $startbutton If $Radio1 = $GUI_CHECKED Then MouseClick ("", $button_x, $button_y) If $Radio2 = $GUI_CHECKED Then MouseClick ("", $button_x, $button_y) Sleep (2000) Then MouseClick ("", $right_button_x, $right_button_y) Sleep (2000) Then MouseClick ("", $button_x, $button_y) Sleep (2000) Then MouseClick ("", $left_button_x, $left_button_y) Sleep (2000) Sleep (100000) WEnd #comments-start--------- Here it must Loop until ESC or EXIT #comments-end----------- HotKeySet("{ESC}", "_Terminate") Func _Terminate() Exit EndFunc While 1 $action = GUIGetMsg() If $action = $GUI_EVENT_CLOSE Then ExitLoop EndIf WEnd I was just put the comment line where was the errors. Without comment line didn't compile anymore. It's a webcam that I must click refresh every 5 minutes clicking one button. In another location there are 2 webcams so I must click on the refresh button, click on the next webcam, refresh this one, and then click back for returning on the first webcam. Link to comment Share on other sites More sharing options...
kylomas Posted October 22, 2014 Share Posted October 22, 2014 sephianesco, Are you using the full SciTE editor for AutoIT? Have you tried running the code using SciTE (F5)? You need to read the Help file (and Wiki) for GUI management. You are missing a message loop and misusing the controls. kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
stefionesco Posted October 22, 2014 Author Share Posted October 22, 2014 (edited) expandcollapse popup#include <GUIConstants.au3> $mainwindow = GUICreate("Title", 280, 200) GUICtrlCreateLabel ("Route", 10, 10) $Radio1 = GUICtrlCreateRadio("1", 30, 30, 100, 20) $Radio2 = GUICtrlCreateRadio("2", 30, 50, 100, 20) GUICtrlSetState($Radio1, $GUI_CHECKED) $start_button = GUICtrlCreateButton("START", 150, 40, 85, 25) $refresh_button_x = 745 $refresh_button_y = 720 $next_button_x = 935 $next_button_y = 585 $prev_button_x = 385 $prev_button_y = 585 GUISetState(@SW_SHOW) HotKeySet("{ESC}", "_Terminate") Func _Terminate() Exit EndFunc While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $start_button Select Case $Radio1 = $GUI_CHECKED MouseClick ("", $refresh_button_x, $refresh_button_y) Sleep (300000) Case $Radio2 = $GUI_CHECKED MouseClick ("", $refresh_button_x, $refresh_button_y) Sleep (2000) MouseClick ("", $next_button_x, $next_button_y) Sleep (2000) MouseClick ("", $refresh_button_x, $refresh_button_y) Sleep (2000) MouseClick ("", $prev_button_x, $prev_button_y) Sleep (300000) EndSelect EndSwitch WEnd This is where I got until now, but it didn't do the "MouseClick". And yes, I use the full SciTE, and I use the F5 for compiling. It's compiling but didn't do anything. I don't know what to do. Edited October 22, 2014 by stefionesco Link to comment Share on other sites More sharing options...
kylomas Posted October 24, 2014 Share Posted October 24, 2014 (edited) Your radio controls cannot be tested that way. Read the Help file for GuiCtrlRead and GuiCtrlCreateRadio. edit: spelling Edited October 24, 2014 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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