Jump to content

interruption of part of the code by means of a button


 Share

Recommended Posts

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

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 by Dan_555

Some of my script sourcecode

Link to comment
Share on other sites

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.

Immagine.jpg

Edited by Maurizio
Link to comment
Share on other sites

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 by Network_Guy
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...