SonOfDiablo Posted February 18, 2011 Share Posted February 18, 2011 Hey guys, I'm writhing my first script. But when I start it (presses the start button) I can't close it again Can someone help me?My Script:expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example() Func Example() Local $Start, $lala, $lala2, $Form1, $nMsg, $Button1, $Group1, $Group2, $Button2, $Checkbox1, $Checkbox2, $Checkbox3, $Checkbox4, $Checkbox5, $Checkbox6, $Checkbox7, $Checkbox8, $Checkbox9, $Checkbox10, $Checkbox11, $Checkbox12, $Checkbox13, $Checkbox14, $Checkbox15, $Checkbox16, $Checkbox17, $Checkbox18, $Checkbox19, $Checkbox20, $Checkbox21, $Checkbox22, $Checkbox23, $Checkbox24, $Checkbox25, $Checkbox26, $Checkbox27, $Checkbox28, $Checkbox29, $Checkbox30, $Checkbox31, $Checkbox32, $Checkbox33, $Checkbox34, $Checkbox35, $Checkbox36, $Checkbox37, $Checkbox38, $Checkbox39, $Checkbox40, $Checkbox41, $Checkbox42, $Checkbox43, $Checkbox44, $Checkbox45, $Checkbox46, $Checkbox47, $Checkbox48, $Checkbox49 $Form1 = GUICreate("Form1", 623, 442, 190, 123) $Button1 = GUICtrlCreateButton("EXIT", 504, 400, 105, 33) $Button2 = GUICtrlCreateButton("START", 8, 400, 105, 33) $Checkbox1 = GUICtrlCreateCheckbox("A", 16, 24, 25, 17) $Checkbox2 = GUICtrlCreateCheckbox("B", 16, 48, 25, 17) $Checkbox3 = GUICtrlCreateCheckbox("C", 16, 72, 25, 17) $Checkbox4 = GUICtrlCreateCheckbox("D", 16, 96, 25, 17) $Checkbox5 = GUICtrlCreateCheckbox("E", 16, 120, 25, 17) $Checkbox6 = GUICtrlCreateCheckbox("F", 16, 144, 25, 17) $Checkbox7 = GUICtrlCreateCheckbox("G", 16, 168, 25, 17) $Checkbox8 = GUICtrlCreateCheckbox("H", 16, 192, 25, 17) $Checkbox9 = GUICtrlCreateCheckbox("I", 16, 216, 25, 17) $Checkbox10 = GUICtrlCreateCheckbox("J", 16, 240, 25, 17) $Checkbox13 = GUICtrlCreateCheckbox("K", 16, 264, 25, 17) $Checkbox14 = GUICtrlCreateCheckbox("L", 16, 288, 25, 17) $Checkbox15 = GUICtrlCreateCheckbox("M", 16, 312, 25, 17) $Checkbox16 = GUICtrlCreateCheckbox("N", 16, 336, 25, 17) $Checkbox17 = GUICtrlCreateCheckbox("O", 16, 360, 25, 17) $Checkbox18 = GUICtrlCreateCheckbox("P", 48, 24, 25, 17) $Checkbox19 = GUICtrlCreateCheckbox("Q", 48, 48, 25, 17) $Checkbox20 = GUICtrlCreateCheckbox("R", 48, 72, 25, 17) $Checkbox21 = GUICtrlCreateCheckbox("S", 48, 96, 25, 17) $Checkbox22 = GUICtrlCreateCheckbox("T", 48, 120, 25, 17) $Checkbox23 = GUICtrlCreateCheckbox("U", 48, 144, 25, 17) $Checkbox24 = GUICtrlCreateCheckbox("V", 48, 168, 25, 17) $Checkbox25 = GUICtrlCreateCheckbox("W", 48, 192, 25, 17) $Checkbox26 = GUICtrlCreateCheckbox("X", 48, 216, 25, 17) $Checkbox27 = GUICtrlCreateCheckbox("Y", 48, 240, 25, 17) $Checkbox28 = GUICtrlCreateCheckbox("Z", 48, 264, 25, 17) $Group1 = GUICtrlCreateGroup("Letters:", 8, 8, 105, 377) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Numbers:", 128, 8, 145, 377) GUICtrlCreateGroup("", -99, -99, 1, 1) $Checkbox11 = GUICtrlCreateCheckbox("1", 136, 24, 25, 17) $Checkbox12 = GUICtrlCreateCheckbox("2", 136, 48, 25, 17) $Checkbox32 = GUICtrlCreateCheckbox("3", 136, 72, 25, 17) $Checkbox33 = GUICtrlCreateCheckbox("4", 136, 96, 25, 17) $Checkbox34 = GUICtrlCreateCheckbox("5", 136, 120, 25, 17) $Checkbox35 = GUICtrlCreateCheckbox("6", 136, 144, 25, 17) $Checkbox36 = GUICtrlCreateCheckbox("7", 136, 168, 25, 17) $Checkbox37 = GUICtrlCreateCheckbox("8", 136, 192, 25, 17) $Checkbox38 = GUICtrlCreateCheckbox("9", 136, 216, 25, 17) $Checkbox39 = GUICtrlCreateCheckbox("0", 136, 240, 25, 17) $Checkbox40 = GUICtrlCreateCheckbox("NUM_1", 136, 264, 57, 17) $Checkbox41 = GUICtrlCreateCheckbox("NUM_2", 136, 288, 57, 17) $Checkbox42 = GUICtrlCreateCheckbox("NUM_3", 136, 312, 57, 17) $Checkbox43 = GUICtrlCreateCheckbox("NUM_4", 136, 336, 57, 17) $Checkbox44 = GUICtrlCreateCheckbox("NUM_5", 136, 360, 57, 17) $Checkbox45 = GUICtrlCreateCheckbox("NUM_6", 208, 24, 57, 17) $Checkbox46 = GUICtrlCreateCheckbox("NUM_7", 208, 48, 57, 17) $Checkbox47 = GUICtrlCreateCheckbox("NUM_8", 208, 72, 57, 17) $Checkbox48 = GUICtrlCreateCheckbox("NUM_9", 208, 96, 57, 17) $Checkbox49 = GUICtrlCreateCheckbox("NUM_0", 208, 120, 57, 17) $Start = 1 GUISetState() While 1 = 1 $nMsg = GUIGetMsg() If $nMsg = $Button2 Then $Start = 2 While $Start = 2 $lala = "a" & Random(1, 46, 1) If $lala = "a1" Then If GUICtrlRead ($Checkbox1) = $GUI_Checked Then a() EndIf EndIf If $lala = "a2" Then If GUICtrlRead ($Checkbox2) = $GUI_Checked Then b() EndIf EndIf If $lala = "a3" Then If GUICtrlRead ($Checkbox3) = $GUI_Checked Then c() EndIf EndIf If $lala = "a4" Then If GUICtrlRead ($Checkbox4) = $GUI_Checked Then d() EndIf EndIf If $lala = "a5" Then If GUICtrlRead ($Checkbox5) = $GUI_Checked Then e() EndIf EndIf If $lala = "a6" Then If GUICtrlRead ($Checkbox6) = $GUI_Checked Then f() EndIf EndIf If $lala = "a7" Then If GUICtrlRead ($Checkbox7) = $GUI_Checked Then g() EndIf EndIf If $lala = "a8" Then If GUICtrlRead ($Checkbox8) = $GUI_Checked Then h() EndIf EndIf If $lala = "a9" Then If GUICtrlRead ($Checkbox9) = $GUI_Checked Then i() EndIf EndIf If $lala = "a10" Then If GUICtrlRead ($Checkbox10) = $GUI_Checked Then j() EndIf EndIf If $lala = "a11" Then If GUICtrlRead ($Checkbox13) = $GUI_Checked Then k() EndIf EndIf If $lala = "a12" Then If GUICtrlRead ($Checkbox14) = $GUI_Checked Then l() EndIf EndIf If $lala = "a13" Then If GUICtrlRead ($Checkbox15) = $GUI_Checked Then m() EndIf EndIf If $lala = "a14" Then If GUICtrlRead ($Checkbox16) = $GUI_Checked Then n() EndIf EndIf If $lala = "a15" Then If GUICtrlRead ($Checkbox17) = $GUI_Checked Then o() EndIf EndIf If $lala = "a16" Then If GUICtrlRead ($Checkbox18) = $GUI_Checked Then p() EndIf EndIf If $lala = "a17" Then If GUICtrlRead ($Checkbox19) = $GUI_Checked Then q() EndIf EndIf If $lala = "a18" Then If GUICtrlRead ($Checkbox20) = $GUI_Checked Then r() EndIf EndIf If $lala = "a19" Then If GUICtrlRead ($Checkbox21) = $GUI_Checked Then s() EndIf EndIf If $lala = "a20" Then If GUICtrlRead ($Checkbox22) = $GUI_Checked Then t() EndIf EndIf If $lala = "a21" Then If GUICtrlRead ($Checkbox23) = $GUI_Checked Then u() EndIf EndIf If $lala = "a22" Then If GUICtrlRead ($Checkbox24) = $GUI_Checked Then v() EndIf EndIf If $lala = "a23" Then If GUICtrlRead ($Checkbox25) = $GUI_Checked Then w() EndIf EndIf If $lala = "a24" Then If GUICtrlRead ($Checkbox26) = $GUI_Checked Then x() EndIf EndIf If $lala = "a25" Then If GUICtrlRead ($Checkbox27) = $GUI_Checked Then y() EndIf EndIf If $lala = "a26" Then If GUICtrlRead ($Checkbox28) = $GUI_Checked Then z() EndIf EndIf If $lala = "a27" Then If GUICtrlRead ($Checkbox11) = $GUI_Checked Then a1() EndIf EndIf If $lala = "a28" Then If GUICtrlRead ($Checkbox12) = $GUI_Checked Then a2() EndIf EndIf If $lala = "a29" Then If GUICtrlRead ($Checkbox32) = $GUI_Checked Then a3() EndIf EndIf If $lala = "a30" Then If GUICtrlRead ($Checkbox33) = $GUI_Checked Then a4() EndIf EndIf If $lala = "a31" Then If GUICtrlRead ($Checkbox34) = $GUI_Checked Then a5() EndIf EndIf If $lala = "a32" Then If GUICtrlRead ($Checkbox35) = $GUI_Checked Then a6() EndIf EndIf If $lala = "a33" Then If GUICtrlRead ($Checkbox36) = $GUI_Checked Then a7() EndIf EndIf If $lala = "a34" Then If GUICtrlRead ($Checkbox37) = $GUI_Checked Then a8() EndIf EndIf If $lala = "a35" Then If GUICtrlRead ($Checkbox38) = $GUI_Checked Then a9() EndIf EndIf If $lala = "a36" Then If GUICtrlRead ($Checkbox39) = $GUI_Checked Then a0() EndIf EndIf If $lala = "a37" Then If GUICtrlRead ($Checkbox40) = $GUI_Checked Then n1() EndIf EndIf If $lala = "a38" Then If GUICtrlRead ($Checkbox41) = $GUI_Checked Then n2() EndIf EndIf If $lala = "a39" Then If GUICtrlRead ($Checkbox42) = $GUI_Checked Then n3() EndIf EndIf If $lala = "a40" Then If GUICtrlRead ($Checkbox43) = $GUI_Checked Then n4() EndIf EndIf If $lala = "a41" Then If GUICtrlRead ($Checkbox44) = $GUI_Checked Then n5() EndIf EndIf If $lala = "a42" Then If GUICtrlRead ($Checkbox45) = $GUI_Checked Then n6() EndIf EndIf If $lala = "a43" Then If GUICtrlRead ($Checkbox46) = $GUI_Checked Then n7() EndIf EndIf If $lala = "a44" Then If GUICtrlRead ($Checkbox47) = $GUI_Checked Then n8() EndIf EndIf If $lala = "a45" Then If GUICtrlRead ($Checkbox48) = $GUI_Checked Then n9() EndIf EndIf If $lala = "a46" Then If GUICtrlRead ($Checkbox49) = $GUI_Checked Then n0() EndIf EndIf WEnd EndIf If $nMsg = $Button1 Then $Start = 1 Exit EndIf $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc Func a() Send ("a", 1) EndFunc Func b() Send ("b", 1) EndFunc Func c() Send ("c", 1) EndFunc Func d() Send ("d", 1) EndFunc Func e() Send ("e", 1) EndFunc Func f() Send ("f", 1) EndFunc Func g() Send ("g", 1) EndFunc Func h() Send ("h", 1) EndFunc Func i() Send ("i", 1) EndFunc Func j() Send ("j", 1) EndFunc Func k() Send ("k", 1) EndFunc Func l() Send ("l", 1) EndFunc Func m() Send ("m", 1) EndFunc Func n() Send ("n", 1) EndFunc Func o() Send ("o", 1) EndFunc Func p() Send ("p", 1) EndFunc Func q() Send ("q", 1) EndFunc Func r() Send ("r", 1) EndFunc Func s() Send ("s", 1) EndFunc Func t() Send ("t", 1) EndFunc Func u() Send ("u", 1) EndFunc Func v() Send ("v", 1) EndFunc Func w() Send ("w", 1) EndFunc Func x() Send ("x", 1) EndFunc Func y() Send ("y", 1) EndFunc Func z() Send ("z", 1) EndFunc Func a1() Send("1", 1) EndFunc Func a2() Send("2", 1) EndFunc Func a3() Send("3", 1) EndFunc Func a4() Send("4", 1) EndFunc Func a5() Send("5", 1) EndFunc Func a6() Send("6", 1) EndFunc Func a7() Send("7", 1) EndFunc Func a8() Send("8", 1) EndFunc Func a9() Send("9", 1) EndFunc Func a0() Send("0", 1) EndFunc Func n1() send("{NUMPAD1}") EndFunc Func n2() send("{NUMPAD2}") EndFunc Func n3() send("{NUMPAD3}") EndFunc Func n4() send("{NUMPAD4}") EndFunc Func n5() send("{NUMPAD5}") EndFunc Func n6() send("{NUMPAD6}") EndFunc Func n7() send("{NUMPAD7}") EndFunc Func n8() send("{NUMPAD8}") EndFunc Func n9() send("{NUMPAD9}") EndFunc Func n0() send("{NUMPAD0}") EndFuncYea it maybe messy, but hey like i saied it's my first script and sry for my english too :/ Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2011 Developers Share Posted February 18, 2011 (edited) What is the intent of this bit? If $nMsg = $Button2 Then $Start = 2 While $Start = 2 ; snipped a bunch of code WEnd EndIf Edited February 18, 2011 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
SonOfDiablo Posted February 18, 2011 Author Share Posted February 18, 2011 What is the intent of this bit? If $nMsg = $Button2 Then $Start = 2 While $Start = 2 ; snipped a bunch of code WEnd EndIf The useage of my script is that you tick the boxes with the number/letter you want it to click and then it will click them randomly If that is what you mean? Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2011 Developers Share Posted February 18, 2011 If that is what you mean?I think I know what your script is about and guess you name gives part of it away, but that is not what I meant with my question.What were you thinking when creating this never ending loop because I do not think you update $Start anywhere in the loop? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
SonOfDiablo Posted February 18, 2011 Author Share Posted February 18, 2011 I think I know what your script is about and guess you name gives part of it away, but that is not what I meant with my question. What were you thinking when creating this never ending loop because I do not think you update $Start anywhere in the loop? ohh that, it's cuz if i had it like: If $nMsg = $Button2 Then While 1 = 1 ; snipped a bunch of code WEnd EndIf and If $nMsg = $Button1 Then Exit EndIf it didn't work so i tried the other to see if that would work, but it don't work eather Link to comment Share on other sites More sharing options...
Developers Jos Posted February 18, 2011 Developers Share Posted February 18, 2011 it didn't work so i tried the other to see if that would work, but it don't work eather Coding isn't about trying but understanding.So think about what I wrote in my previous post and answer it for yourself. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
SonOfDiablo Posted February 18, 2011 Author Share Posted February 18, 2011 Coding isn't about trying but understanding. So think about what I wrote in my previous post and answer it for yourself. okay if i get you right, you want me to remove the endless loop after If $nMsg = $Button2 Then but if i do that it just presses the button 1 time after i have pressed "Start" :/ 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