Jump to content

GUI button issue


markdui
 Share

Recommended Posts

Hi may i know how can i do the below in AutoIT GUI

Create a Button upon mouse click it will run a batch file.

Create a Inputbox (textbox). The batch file will call the textinout and excute then and sent the output to a screen below it.

Could you please provide us with some GUI code?? And what you have tried?

Also, look at Run in the helpfile.

:)

Link to comment
Share on other sites

I have try creating some button and inputbox. Didnt know how to place the rest of the code. Anyway i will try reading the run in help. Thanks

Well here's how I do it.

;;All the needed includes...
#include <GuiConstants.au3>
;Any Varibles are declared.
Dim $var = "I am a varible.  W00000tttttt!"
;GUI is created
GUICreate($var)
;And GUI Opt modes can be declared here, or above.
Opt("GUICoordMode", 2); Alters the positioning of controls.
;Create any controls on the GUI
$Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100)
$Button_2 = GUICtrlCreateButton("Button Test", 0, -1)
;Show the GUI
GUISetState(@SW_SHOW)

;Run The GUI until the dialouge is closed
While 1
;Poll the GUI for any changes- Button Presses, changes in text...
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE; So if the big red X on the GUI is pressed, exit
            ExitLoop
        Case $msg = $Button_1; if $button_1 is pressed
            Run('Notepad.exe')   ; Will run notepad
        Case $msg = $Button_2; if $button_2 is pressed
            MsgBox(0, 'Testing', 'Button 2 was pressed')   ; Shows a message box that apears when the button was pressed.
    EndSelect
WEnd

That should get you on your merry way... =)

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