Jump to content

Can you combine the run command with a button


Street
 Share

Recommended Posts

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")

Link to comment
Share on other sites

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