as5bcr Posted January 16, 2007 Share Posted January 16, 2007 i want to make a simple interface. one that has only a button, start/stop. how can i make this? Link to comment Share on other sites More sharing options...
SAG Posted January 16, 2007 Share Posted January 16, 2007 The easy way to learn is to use the Koda FormDesigner (Alt+m from the SciTE editor). Use that to see how it lays out the form and then you can extend it yourself. Here's an example of what you asked for... #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 625, 445, 193, 115) $Button1 = GUICtrlCreateButton("AButton1", 232, 192, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ; do something whem button is pressed EndSwitch WEnd Link to comment Share on other sites More sharing options...
as5bcr Posted January 17, 2007 Author Share Posted January 17, 2007 done. thanks. now i ve got another question. i ve added another button. one is for start and one for stop. but once i ve clicked on "start" i can t click "stop". why?? Link to comment Share on other sites More sharing options...
Valuater Posted January 17, 2007 Share Posted January 17, 2007 done. thanks. now i ve got another question. i ve added another button. one is for start and one for stop. but once i ve clicked on "start" i can t click "stop". why?? need to show us the code so we can see what it is doing.. post code like this [ code] ; no spaces ; past code here [ /code] ; no spaces or you can use [ autoit] and [ /autoit] 8) Link to comment Share on other sites More sharing options...
as5bcr Posted January 17, 2007 Author Share Posted January 17, 2007 (edited) Well it is a program that sends F5 until the user clicks on "Stop". but i can't understand how to do this. #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 225, 145, 93, 15) $Button1 = GUICtrlCreateButton("Start", 50, 30, 90, 25, 0) $Button2 = GUICtrlCreateButton("Stop", 50, 70, 90, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Do Send("{F5}") Until *what*? EndSwitch WEnd i tried to do somehing like: Case $Button2 Exit but when i click on button 2 it does nothing. Edited January 17, 2007 by as5bcr Link to comment Share on other sites More sharing options...
James Posted January 17, 2007 Share Posted January 17, 2007 #include <GUIConstants.au3> #include <Misc.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 225, 145, 93, 15) $Button1 = GUICtrlCreateButton("Start", 50, 30, 90, 25, 0) $Button2 = GUICtrlCreateButton("Stop", 50, 70, 90, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Do Send("{F5}") Until _IsPressed($Button2) EndSwitch WEndUn-Tested Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
as5bcr Posted January 17, 2007 Author Share Posted January 17, 2007 it gives an error that says: Until _IsPressed($Button2) Until ^ ERROR Error: Unknown function name. Link to comment Share on other sites More sharing options...
Helge Posted January 17, 2007 Share Posted January 17, 2007 (edited) @Secure_ICT : That you hadn't tested it wasn't needed to point out, as it was pretty obvious @as5bcr : : In your While/WEnd-loop you're using GUIGetMsg, however that's not the case in yourDo/Until-loop. So, how do you expect that any actions you do in your GUI is going to affect anythingat all in your script ? It's not like it can glance at GUIGetMsg from the outer loop and automagicallyfigure out what to do accordingly.EDIT : What version are you using ? Edited January 17, 2007 by Helge Link to comment Share on other sites More sharing options...
as5bcr Posted January 17, 2007 Author Share Posted January 17, 2007 i use autoit 3. what can i do to solve my problem? Link to comment Share on other sites More sharing options...
Helge Posted January 17, 2007 Share Posted January 17, 2007 I got that alright, but could you tell the exact version-number ? The latest is 3.2.2.0. Run this script and tell us what it says : MsgBox(64, "", @AutoItVersion) Link to comment Share on other sites More sharing options...
as5bcr Posted January 17, 2007 Author Share Posted January 17, 2007 it is 3.2.0.1. shall i update it? Link to comment Share on other sites More sharing options...
SAG Posted January 18, 2007 Share Posted January 18, 2007 it is 3.2.0.1. shall i update it? I'd suggest yes - update to the current version. Here's one method that should do what you want. #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("AForm1", 225, 145, 93, 15) $Button1 = GUICtrlCreateButton("Start", 50, 30, 90, 25, 0) $Button2 = GUICtrlCreateButton("Stop", 50, 70, 90, 25, 0) $Label1 = GUICtrlCreateLabel("Counter", 50, 110, 90, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $KeepLooping = 1 $Count = -1 While $KeepLooping $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 ; use this to start $Count = 0 Case $Button2 ; use this to stop $KeepLooping = 0 EndSwitch If $Count >= 0 Then ; put the stuff to repeat in this loop $Count = $Count + 1 GUICtrlSetData($Label1, $Count) EndIf WEnd Link to comment Share on other sites More sharing options...
as5bcr Posted January 18, 2007 Author Share Posted January 18, 2007 thanks a lot , it works now. Link to comment Share on other sites More sharing options...
Vindicator209 Posted January 18, 2007 Share Posted January 18, 2007 (edited) it gives an error that says: Until _IsPressed($Button2) Until ^ ERROR Error: Unknown function name. did you happen to include misc.au3? #include <Misc.au3> although I'm not sure if _ispressed is a function in there.. but seeing as it says unknown functino name, its nice to know what yove included XD but seeing as your problem is solved never mind XD Edited January 18, 2007 by MethodZero [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] 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