Sign in to follow this  
Followers 0
Testy

100% Noob question - Warning.

4 posts in this topic

#1 ·  Posted (edited)

Ok, I'm fairly adept at Autoit2.

I'm trying to create a button that runs a program from AUTOIT3. I've searched the examples, they are mainly message box functions. I searched forums, but I'm not using the right keywords, or the users are more advanced than I and the function is rudimentary.

If I could get a generic button script I could leap from there.

Many thank and a decent apology added.

Edited by Testy

Share this post


Link to post
Share on other sites



Basic but that is what you asked for

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 328, 221, 193, 115)
$Button1 = GUICtrlCreateButton("Run Notepad", 32, 32, 113, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Run("notepad.exe")
    EndSwitch
WEnd


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Basic but that is what you asked for

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 328, 221, 193, 115)
$Button1 = GUICtrlCreateButton("Run Notepad", 32, 32, 113, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Run("notepad.exe")
    EndSwitch
WEnd
Your script is good, and very helpful. Last question. How do I duplicate the buttons on one tab? When I try to duplicate your script, it only put one button and removes my other tabs.

Share this post


Link to post
Share on other sites

Something like this ?

#include <GUIConstants.au3>

$Form1 = GUICreate("Form1", 328, 221, 193, 115)
$Button1 = GUICtrlCreateButton("Run Notepad", 32, 32, 113, 25, 0)
$Button2 = GUICtrlCreateButton("Run mspaint", 32, 62, 113, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            Run("mspaint.exe")
        Case $Button1
            Run("notepad.exe")
    EndSwitch
WEnd

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.

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