Jump to content

Start running on button press


Assault
 Share

Recommended Posts

I want the script to start after a button on the gui is pressed, I'm using this :

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            exit
        Case $nmsg = $Button1
            call("main")    
        Case $nmsg = $Button2
           Exit

    EndSwitch
WEnd

but it starts the script before the button is pressed.

Link to comment
Share on other sites

While 1
    $nMsg = GUIGetMsg()
    Select $nMsg
        Case $nMsg = $GUI_EVENT_CLOSE
            exit
        Case $nMsg = $Button1
           main()   
        Case $nMsg = $Button2
          Exit
    EndSelect
WEnd

Func main()
    Msgbox(266288,"No Title","$Button1 pressed")
EndFunc

Eltorro

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...