Jump to content

using GUI to execute part(s) of the script code


Foxtrot
 Share

Recommended Posts

hey guys, i looked the explanations in 'http://www.autoitscript.com/autoit3/docs/functions/' through, and wasn't able to figure out how to make your GUI call parts of your code by clicking a button :-/ anyone able to help me here? if my problem isn't clear enough, please tell me and ill try to explain better.

Thanks, Foxtrot

edit: ooh and i only want a single .exe file, nothing else - if possible

Edited by Foxtrot
Link to comment
Share on other sites

The parts you want to separate should be done in functions.

Then modify the GuiCtrlCreateButton sample in the help file.

#include <GUIConstants.au3>
Main()
Exit
Func Main()
GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered

Opt("GUICoordMode",2)
$Button_1 = GUICtrlCreateButton ("Run Notepad",  10, 30, 100)
$Button_2 = GUICtrlCreateButton ( "Button Test",  0, -1)

GUISetState ()      ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
            JobbOne()
        Case $msg = $Button_2
            JobTwo()
    EndSelect
Wend
End Func
Func JobOne()
    Msgbox(48, "JobOne","Hello")
EndFunc
Func JobTwo()
    Msgbox(48, "JobTwo","Hello")
EndFunc
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...