Sign in to follow this  
Followers 0
Dasttann777

Really Basic GUI Help

3 posts in this topic

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 :D ::dance::ILA2:


Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list]

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by ArmandCool

Share this post


Link to post
Share on other sites

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
Perfect 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]

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