Maurizio Posted October 22, 2020 Share Posted October 22, 2020 Hi Foro I wanted to ask you if it was possible to suspend, based on your choice, a part of the code without compromising the rest. In the example that I am attaching, I take as an example, the central part of the code enclosed within the two lines of X. Is it possible to activate and deactivate this part of the code with a button? Thanks in advance. MouseClick("left",522, 493, 1) Sleep(2000) MouseClick("left",717, 263, 1) Send ("1") Sleep(500) MouseClick("left",878, 261, 1) Send ("282") Sleep(2000) MouseClick("left",938, 261, 1) Sleep(1000) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX MouseClick("left",522, 493, 1) Sleep(2000) MouseClick("left",717, 263, 1) Send ("1") Sleep(500) MouseClick("left",878, 261, 1) Send ("282") Sleep(2000) MouseClick("left",938, 261, 1) Sleep(1000) XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX MouseClick("left",522, 493, 1) Sleep(2000) MouseClick("left",717, 263, 1) Send ("1") Sleep(500) MouseClick("left",878, 261, 1) Send ("282") Sleep(2000) MouseClick("left",938, 261, 1) Sleep(1000) Link to comment Share on other sites More sharing options...
Dan_555 Posted October 22, 2020 Share Posted October 22, 2020 (edited) Please give more accurate description. What does compromising means to you ? You have 3 parts of the code there. When you click on the start/stop button, what should happen ? There are few possibilities. A. The start button is starting always from the 1st part. B. The start/stop button is continuing to run the code from the next part. (edit, and at the end of it, it begins with the 1st part) Edited October 22, 2020 by Dan_555 Some of my script sourcecode Link to comment Share on other sites More sharing options...
Maurizio Posted October 22, 2020 Author Share Posted October 22, 2020 (edited) as shown in the attached photo, there are three groups with relative buttons. What I meant is whether it was possible to use buttons to bypass the piece of code that belongs to that piece of code. Let's say that the three pieces of code are independent, but if placed in the same script page, they will automatically be read. Depending on whether the button is clicked or not, I would like to activate the reading of that part of the code, or not let it be read. Edited October 22, 2020 by Maurizio Link to comment Share on other sites More sharing options...
Dan_555 Posted October 22, 2020 Share Posted October 22, 2020 (edited) You can place the 3 code parts in separate functions and call each function with a button. Edited October 22, 2020 by Dan_555 Some of my script sourcecode Link to comment Share on other sites More sharing options...
Maurizio Posted October 22, 2020 Author Share Posted October 22, 2020 and how do you write this formula with a condition? Link to comment Share on other sites More sharing options...
Network_Guy Posted October 22, 2020 Share Posted October 22, 2020 (edited) here is an example:- $Button1 = GUICtrlCreateButton("Button1", 136, 96, 75, 25) $Bool_executecodesection=true MouseClick("left",522, 493, 1) Sleep(2000) ; section need to be excuted deben on the button if $Bool_executecodesection= true then MouseClick("left",717, 263, 1) Send ("1") Sleep(500) MouseClick("left",878, 261, 1) Send ("282") Sleep(2000) endif ;/////////////////////////////////////// MouseClick("left",938, 261, 1) Sleep(1000) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 $Bool_executecodesection= not $Bool_executecodesection EndSwitch WEnd Edited October 22, 2020 by Network_Guy 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