dgarrett8 Posted January 14, 2008 Share Posted January 14, 2008 This is what I have. I want to make the " OK " button to open up a program. What is the cmd for that? expandcollapse popup#include <GuiConstants.au3> ; Create the GUI. GuiCreate("LmH ", 300, 135) GuiSetIcon( "", 1) Global $defaultstatus = "Ready" Global $status $filemenu = GUICtrlCreateMenu ("&File") $fileitem = GUICtrlCreateMenuitem ("WHAT",$filemenu) GUICtrlSetState(-1,$GUI_DISABLE) $helpmenu = GUICtrlCreateMenu ("About Us") $saveitem = GUICtrlCreateMenuitem ("Save",$filemenu) GUICtrlSetState(-1,$GUI_DISABLE) $infoitem = GUICtrlCreateMenuitem ("Info",$helpmenu) $exititem = GUICtrlCreateMenuitem ("Exit",$filemenu) $recentfilesmenu = GUICtrlCreateMenu ("Recent Files",$filemenu,1) $separator1 = GUICtrlCreateMenuitem ("",$filemenu,2); create a separator line $viewmenu = GUICtrlCreateMenu("View",-1,1); is created before "?" menu $viewstatusitem = GUICtrlCreateMenuitem ("Statusbar",$viewmenu) GUICtrlSetState(-1,$GUI_CHECKED) $okbutton = GUICtrlCreateButton ("OK",25,50,107,20) GUICtrlSetState(-1,$GUI_FOCUS) $cancelbutton = GUICtrlCreateButton ("Cancel",150,50,70,20) $statuslabel = GUICtrlCreateLabel ($defaultstatus,0,165,300,16,BitOr($SS_SIMPLE,$SS_SUNKEN)) GUISetState () While 1 $msg = GUIGetMsg() If $msg = $viewstatusitem Then If BitAnd(GUICtrlRead($viewstatusitem),$GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($viewstatusitem,$GUI_UNCHECKED) GUICtrlSetState($statuslabel,$GUI_HIDE) Else GUICtrlSetState($viewstatusitem,$GUI_CHECKED) GUICtrlSetState($statuslabel,$GUI_SHOW) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton Or $msg = $exititem Then ExitLoop If $msg = $infoitem Then Msgbox(0,"Info","*****************.") WEnd GUIDelete() Exit "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted January 15, 2008 Moderators Share Posted January 15, 2008 The help file has a good example of this under GUICtrlCreateButton(). Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 15, 2008 Author Share Posted January 15, 2008 (edited) Ok, but I'm trying to make OK to run this Sleep(3000);3 seconds $i = 1 While $i <= 41 $variable = ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<' Send($variable & @CRLF) $i += 1 Wend Exit Edited January 15, 2008 by dgarrett8 "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted January 15, 2008 Moderators Share Posted January 15, 2008 Is that code going to be compiled as an exe, or are you wanting to run it as a function? Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 15, 2008 Author Share Posted January 15, 2008 I'm going to compile this script into an exe "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted January 15, 2008 Moderators Share Posted January 15, 2008 I'm going to compile this script into an exeThen the example in the help file fits perfectly. Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 15, 2008 Author Share Posted January 15, 2008 My mistake, I meant that it will be added to the original script and all together compressed as an exe. So I guess to answer your question, that this would be a function Sleep(3000);3 seconds $i = 1 While $i <= 41 $variable = ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<' Send($variable & @CRLF) $i += 1 Wend Exit "I think, therefore I am"[size="1"]René Descartes[/size] Link to comment Share on other sites More sharing options...
FireLordZi Posted January 15, 2008 Share Posted January 15, 2008 @dgarret8 Try this: #include <GUIConstants.au3> $gui = GUICreate("", 200, 200) GUISetState() $ok = GUICtrlCreateButton("OK", 10, 10) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_Event_Close Exit 0 Case $msg = $ok func1() EndSelect WEnd Func func1() Sleep(3000); Sleep 3 seconds $i = 1 While $i <= 41 $variable = ' <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<' Send($variable & @CRLF) $i += 1 Wend Exit EndFunc This just gives you the basic understanding, you can incorporate your code from wherever. While Alive() { DrinkWine(); }AutoIt Programmer Link to comment Share on other sites More sharing options...
NELyon Posted January 15, 2008 Share Posted January 15, 2008 (edited) Put all of that code into a function, and set the button to call the function like so: ...Your GUI code While 1 If GUIGetMsg() = $Button_1 Then _MyFunc() EndIf Wend Edit: Got beat by someone on their first post. Welcome to the forums FireLordZi Edited January 15, 2008 by Senton-Bomb Link to comment Share on other sites More sharing options...
dgarrett8 Posted January 15, 2008 Author Share Posted January 15, 2008 Lol, did some experimenting and my result was fine for my first program: ) ty guys. i was creating a msn booter. i could post if you want. "I think, therefore I am"[size="1"]René Descartes[/size] 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