Sign in to follow this  
Followers 0
Foxtrot

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

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



for some reason i can't edit my first post. I just wanted to tell people that i don't want them to do it for me, but just to help me understand :P i'm here to learn.

thanks

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

ah yes, thanks alot! that did it for me, could you tell me how to get a button to stop my code as well? The thing is that the thing im starting is looping, so would be nice with a button to stop :P

Share this post


Link to post
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
Sign in to follow this  
Followers 0