original21 Posted April 14, 2007 Share Posted April 14, 2007 Hello to all. I am new in the autoit forum and i need your help. I want to make a small GUI with 2 buttons. Every button executes a .exe or .cmd file. I dont have a script to show you, but can you please point me to the wright direction? I check the General Help and Support topic for help but it confized me more. Thanks Please allow me to introduce myself I'm a man of wealth and taste I've been around for a long, long year Stole many a man's soul and faith Link to comment Share on other sites More sharing options...
MHz Posted April 14, 2007 Share Posted April 14, 2007 Look at Koda within Scite4AutoIt3 to make your 2 button gui.http://www.autoitscript.com/autoit3/scite/Come back when your stuck at the next step of what to do. Link to comment Share on other sites More sharing options...
original21 Posted April 15, 2007 Author Share Posted April 15, 2007 Thanks MHz. Here is the code that Koda generate. I have the 2 buttons on the form. How i add the code for each button to run the .cmd files Thanks again =============================================== #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $MyForm = GUICreate("MyForm", 633, 454, 193, 115) $Button1 = GUICtrlCreateButton("Backup", 136, 168, 75, 25, 0) $Button2 = GUICtrlCreateButton("Restore", 376, 168, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd ====================================================== Please allow me to introduce myself I'm a man of wealth and taste I've been around for a long, long year Stole many a man's soul and faith Link to comment Share on other sites More sharing options...
BrettF Posted April 15, 2007 Share Posted April 15, 2007 (edited) Ok. Now you have to create another case to tell what happens when the button is pressed. So that looks like: Switch $nMsg Case $button1 ;Do Stuff Case $button2 ;Do More stuff EndSwitchoÝ÷ Ø Ý¶§i×m«m¢Ø^)jëh×6Switch $nMsg Case $button1 Run("Notepad.exe", "", @SW_MAXIMIZE) Case $button2 ShellExecute("Notepad.exe") EndSwitch EDIT: Missed a bit Edited April 15, 2007 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
original21 Posted April 15, 2007 Author Share Posted April 15, 2007 (edited) Thanks for your help Bertt Is working fine. Here is the script : ============================================ #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $MyForm = GUICreate("MyForm", 633, 454, 193, 115) $Button1 = GUICtrlCreateButton("Button1", 136, 168, 75, 25, 0) $Button2 = GUICtrlCreateButton("Button2", 376, 168, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Switch $nMsg Case $button1 Run("Notepad.exe", "", @SW_MAXIMIZE) Case $button2 Run("Notepad.exe", "", @SW_MAXIMIZE) EndSwitch WEnd ================================================================= One final question. Can i add some text on the form? Edited April 15, 2007 by original21 Please allow me to introduce myself I'm a man of wealth and taste I've been around for a long, long year Stole many a man's soul and faith Link to comment Share on other sites More sharing options...
MHz Posted April 15, 2007 Share Posted April 15, 2007 One final question. Can i add some text on the form?Yes you can add text by using a label. Look at the function GUICtrlCreateLabel() in the help file. #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $MyForm = GUICreate("MyForm", 633, 454, 193, 115) GUICtrlCreateLabel('Some text on a label', 20, 20) $Button1 = GUICtrlCreateButton("Button1", 136, 168, 75, 25, 0) $Button2 = GUICtrlCreateButton("Button2", 376, 168, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Run("Notepad.exe", "", @SW_MAXIMIZE) Case $Button2 Run("Notepad.exe", "", @SW_MAXIMIZE) EndSwitch WEnd Link to comment Share on other sites More sharing options...
BrettF Posted April 15, 2007 Share Posted April 15, 2007 Thanks for your help Bertt Its Brett or Bert, whatever you prefer When putting autoit code into you posts, make sure you use the tags for them. It makes them so much easier to read The button with the "A" is the one you want... or [ autoit ][/ autoit ] (Withoutspaces!) Regards Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
original21 Posted April 16, 2007 Author Share Posted April 16, 2007 Thanks again to all. Is working fine. Sorry Brett Please allow me to introduce myself I'm a man of wealth and taste I've been around for a long, long year Stole many a man's soul and faith Link to comment Share on other sites More sharing options...
BrettF Posted April 16, 2007 Share Posted April 16, 2007 Thanks again to all.Is working fine.Sorry Brett lol.... Its k. glad to be of assistance kind sir Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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