Dasttann777 Posted April 19, 2012 Share Posted April 19, 2012 Hi I am having trouble getting my buttons to work, as I do not understand properly how to script buttons. Anyway, I am trying to make a Gui with 2 different buttons, one to start paint, and the other notepad, but it does not seem to work. Here is my code: #include <GUIConstants.au3> $Form1 = GUICreate("Form1", 625, 443, 193, 125) $Button1 = GUICtrlCreateButton("Paint", 8, 8, 137, 25, 0) $Button2 = GUICtrlCreateButton("Notepad", 466, 10, 137, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 Run("Paint.exe","Untitled - Paint") EndSwitch WEnd While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I am so New to Auto-it so thank you for helping! :D Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
ProgrammerKid Posted April 19, 2012 Share Posted April 19, 2012 (edited) Try this one:#include <GUIConstants.au3> $Form1 = GUICreate("Form1", 625, 443, 193, 125) $Button1 = GUICtrlCreateButton("Paint", 8, 8, 137, 25, 0) $Button2 = GUICtrlCreateButton("Notepad", 466, 10, 137, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Run("mspaint.exe") Case $Button2 Run("Notepad.exe") EndSwitch WEnd Edited April 19, 2012 by ArmandCool Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 20, 2012 Author Share Posted April 20, 2012 Try this one: #include <GUIConstants.au3> $Form1 = GUICreate("Form1", 625, 443, 193, 125) $Button1 = GUICtrlCreateButton("Paint", 8, 8, 137, 25, 0) $Button2 = GUICtrlCreateButton("Notepad", 466, 10, 137, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Run("mspaint.exe") Case $Button2 Run("Notepad.exe") EndSwitch WEndPerfect Thankyou! Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now