nf67 Posted May 21, 2007 Share Posted May 21, 2007 Hey there,I am new to both programming and AutoIt v3. I wanted to make some auto launch program with checkboxes and a Launch button.Everything checked should launch then. Now I copied and pasted some code together and I got this:expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Window", 633, 449, 193, 115) $Checkbox1 = GUICtrlCreateCheckbox("Rock", 136, 144, 73, 57) $Checkbox2 = GUICtrlCreateCheckbox("Trance", 136, 184, 65, 57) $Checkbox3 = GUICtrlCreateCheckbox("HipHop", 136, 232, 73, 49) $MyButton1 = GUICtrlCreateButton("Launch!", 256, 312, 100, 30, $BS_FLAT) ; <- LOOK! $Checkbox4 = GUICtrlCreateCheckbox("Steam", 272, 160, 73, 25) $Checkbox5 = GUICtrlCreateCheckbox("FireFox", 400, 160, 73, 33) $Checkbox6 = GUICtrlCreateCheckbox("Opera", 400, 200, 73, 33) $Group1 = GUICtrlCreateGroup("Music", 112, 128, 129, 169) GUICtrlCreateGroup("", -99, -99, 1, 1) $Checkbox7 = GUICtrlCreateCheckbox("Rakion", 272, 200, 65, 33) $Group2 = GUICtrlCreateGroup("Games", 256, 128, 105, 169) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Internet", 384, 128, 97, 169) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Select Case $msg = $MyButton1 ; <-- LOOK! run ( "notepad.exe" ) ;This is just a test Endselect While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndI don't really know what half the code is for but whatever, I do get the important things.Now I tought that the Case msg thing was supposed to target one of the buttons or checkboxes.To test it I made the launch button launch Notepad. BUt when I launched the program it said:Line 23 ( file blabla )Case $msg = $MyButton1Case ^ERRORError: Variable used without being declaredWhat can I do? I don't even know what a variable is. Link to comment Share on other sites More sharing options...
Zedna Posted May 21, 2007 Share Posted May 21, 2007 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $msg = $MyButton1 ; <-- LOOK! run ( "notepad.exe" ) ;This is just a test EndSwitch WEnd Look at examples in Autoit Helpfile at GUICreate() and GUICtrlCreateButton() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
November Posted May 21, 2007 Share Posted May 21, 2007 (edited) Checked #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Window", 633, 449, 193, 115) $Checkbox1 = GUICtrlCreateCheckbox("Rock", 136, 144, 73, 57) $Checkbox2 = GUICtrlCreateCheckbox("Trance", 136, 184, 65, 57) $Checkbox3 = GUICtrlCreateCheckbox("HipHop", 136, 232, 73, 49) $MyButton1 = GUICtrlCreateButton("Launch!", 256, 312, 100, 30, $BS_FLAT) ; <- LOOK! $Checkbox4 = GUICtrlCreateCheckbox("Steam", 272, 160, 73, 25) $Checkbox5 = GUICtrlCreateCheckbox("FireFox", 400, 160, 73, 33) $Checkbox6 = GUICtrlCreateCheckbox("Opera", 400, 200, 73, 33) $Group1 = GUICtrlCreateGroup("Music", 112, 128, 129, 169) GUICtrlCreateGroup("", -99, -99, 1, 1) $Checkbox7 = GUICtrlCreateCheckbox("Rakion", 272, 200, 65, 33) $Group2 = GUICtrlCreateGroup("Games", 256, 128, 105, 169) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Internet", 384, 128, 97, 169) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Select Case $nmsg = $MyButton1 ; <-- LOOK! run ( "notepad.exe" ) ;This is just a test case $nmsg = $GUI_EVENT_CLOSE Exit Endselect WEnd P.S. : Next time i'll beat you Zedna LOOOOLLLOOOOL Cheers Edited May 21, 2007 by november Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] 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