Jump to content

100% Noob question - Warning.


Testy
 Share

Recommended Posts

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


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

Link to comment
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.
Link to comment
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.
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...