LoLd Posted April 9, 2011 Share Posted April 9, 2011 Help please? I'm very new to AutoIt and Koda and had a question: How do you make it so that when you click a button a program is run? I've had trouble with this, as I tried this: If $button = "MouseClick" Then Run("notepad.exe") Exit EndIf To no avail. Whats the command you place where I had put "MouseClick"? It would be for when the button is clicked a program is run. If anyone could help me that would be great Thanks, ~LoLd Link to comment Share on other sites More sharing options...
GEOSoft Posted April 9, 2011 Share Posted April 9, 2011 A bit more of your code would help. If you are using EventMode then you do it with an event handler and if you are using a message loop you do it differently. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 9, 2011 Share Posted April 9, 2011 Welcome to the Forum!Read this, GUICtrlCreateButton, and the rest of the Help file while you're at it..Good luck! - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
GianAutoitprogrammer Posted April 15, 2011 Share Posted April 15, 2011 Here is the code... expandcollapse popup#cs Code by Gian Programs Koda Autoit #ce ;If $button = "MouseClick" Then ;Run("notepad.exe") ;Exit ;EndIf #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 173, 56, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 16, 8, 137, 41) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button1 ;=> $Button1 = GUICtrlCreateButton("Button1", 16, 8, 137, 41) ;Please add the "Case" command example: ; Case $button1 ; = write something... Run("notepad.exe");=> this will run the notepad.exe EndSwitch WEnd Link to comment Share on other sites More sharing options...
FMS Posted April 15, 2011 Share Posted April 15, 2011 Or something like this #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 217, 110, 192, 114) $Button1 = GUICtrlCreateButton("Button1", 8, 8, 193, 89, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Run ( "notepad.exe") EndSwitch WEnd as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
pieeater Posted April 16, 2011 Share Posted April 16, 2011 a little bit more simpler GuiCreate("Open Notepad",275,77,669,357) ;make a Graphic User Interface (gui) $button1=GuiCtrlCreateButton("Open",91,6,50,20) ;make a button $label1=GuiCtrlCreateLabel("Click here to open",70,30,100,15) ;make a lable GuiSetState() While 1 $msg=GuiGetMsg() ;get input from gui If $msg=-3 Then Exit If $msg=$button1 Then Run("notepad.exe") WEnd [spoiler]My UDFs: Login UDF[/spoiler] 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