Jump to content
Sign in to follow this  
Street

Can you combine the run command with a button

Recommended Posts

Street

Just wondering if you can create the gui with a button then on push it will activate a program. Such as with the notepad example in the help file for autoit.

Though the notepad exampe is only a stand alone script.

Im just trying to work something out so as lets say if i create a gui and say i want to start a program that is say on my e partition. All i have to do is press the button

And wa-la the program starts.

I know the syntax for the stand alone command would be Run("E:\any-program.exe")

Share this post


Link to post
Share on other sites
steveR

#include <guiconstants.au3>

GUICreate( "", 100, 100)

$btn = GUICtrlCreateButton("Press", 35,45)
GUISetState()

Do
    
    $msg = GUIGetMsg()
    if $msg = $btn Then _runProg()
 
until $msg = $GUI_EVENT_CLOSE


Func _runProg()
    
    Run("notepad") 
    
EndFunc


AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.

Share this post


Link to post
Share on other sites
Street

Thx ill give this a try in the morning.

I appreciate your help.

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  

×