snoopy Posted January 31, 2009 Share Posted January 31, 2009 As you can see the 1st box works fine but the 2nd one seems like when i press it it just goes stright to the mouse click parts and the pixel search , and i dont want it to do that unless i marked it and than pressed start...... debugging doesnt give me anything -.- expandcollapse popup#AutoIt3Wrapper_Run_Debug_Mode=Y #include <GUIConstants.au3> #include<WindowsConstants.au3> Dim $MyButton2; need to declare MyButton2 Global $f_Run = False, $f_AnyChecked = False Global $Form1 = GUICreate("Form1", 625, 444, 189, 146) $Pic1 = GUICtrlCreatePic("C:\Users\Snoopy\Desktop\toontown%20awesome%20picture.jpg", 0, 0, 625, 441, 0) GUISetState($GUI_DISABLE) GuiCtrlSetState($pic1, $GUI_DISABLE) Global $Credits = GUICtrlCreateButton("Credits", 0, 0, 153, 65, 0) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") Global $MyButton1 = GUICtrlCreateButton("Start", 520, 0, 100, 30, 0) GUICtrlSetFont(-1, 15, 800, 0, "MS Serif") GUICtrlSetBkColor(-1, 0xFFFFE1) $checkbox_dummy_start = GUICtrlCreateDummy() Global $CheckBox1 = GUICtrlCreateCheckbox("Jump", 520, 32, 100, 30, 0) Global $CheckBox2 = GUICtrlCreateCheckbox("Beg", 520, 72, 100, 30, 0) Global $CheckBox3 = GUICtrlCreateCheckbox("Say", 520, 112, 100, 30, 0) Global $CheckBox4 = GUICtrlCreateCheckbox("Roallover", 520, 160, 100, 30, 0) $checkbox_dummy_end = GUICtrlCreateDummy() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Credits MsgBox(64, "Credits", "Matthew Povolotski, Toon:Sniffy Macnose") Case $MyButton1 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False If BitAND(GUICtrlRead($CheckBox1), $GUI_CHECKED) Then $f_AnyChecked = True Local $randomcoords[7][2] = [[210,62],[200,77],[200,93],[200,108],[200,124],[200,139],[200,156]] $pixelSearch=PixelSearch(57,45,@DesktopWidth,@DesktopHeight,0xB4EC8F) If IsArray($pixelSearch)=1 Then MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,0) EndIf sleep( 100) $pixelSearch=PixelSearch(153,62,@DesktopWidth,@DesktopHeight,0x080999) If IsArray($pixelSearch)=1 Then MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,0) EndIf $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) EndIf WEnd Case $MyButton2 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False If BitAND(GUICtrlRead($CheckBox2), $GUI_CHECKED) Then $f_AnyChecked = True Local $randomcoords[7][2] = [[289,83],[200,77],[200,93],[200,108],[200,124],[200,139],[200,156]] $pixelSearch=PixelSearch(57,45,@DesktopWidth,@DesktopHeight,0xB4EC8F) If IsArray($pixelSearch)=1 Then MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,0) EndIf sleep( 100) $pixelSearch=PixelSearch(153,62,@DesktopWidth,@DesktopHeight,0x080999) If IsArray($pixelSearch)=1 Then MouseClick("left",$pixelSearch[0],$pixelSearch[1],1,0) EndIf $r = Random(0,6,1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) EndIf If BitAND(GUICtrlRead($CheckBox3), $GUI_CHECKED) Then $f_AnyChecked = True MsgBox(64, "Checkbox 3", "CheckBox 3 is checked", 1) EndIf If BitAND(GUICtrlRead($CheckBox4), $GUI_CHECKED) Then $f_AnyChecked = True MsgBox(64, "Checkbox 4", "CheckBox 4 is checked", 1) EndIf If Not $f_AnyChecked Then ExitLoop WEnd HotKeySet("{F5}") EndSwitch WEnd Func _StopIt() $f_Run = False EndFunc Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF) Switch $iIDFrom Case $checkbox_dummy_start to $checkbox_dummy_end for $i = $checkbox_dummy_start to $checkbox_dummy_end if $i <> $iIDFrom then GUICtrlSetState($i,4) Next EndSwitch EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2009 Moderators Share Posted January 31, 2009 (edited) snoopy,$MyButton2 is declared at the beginning, but is never given a value or created in the rest of your script.What is $MyButton2 for? Why is it in your GUIGetMsg loop if it does not exist? I am pretty sure that this is the cause of your problem as trying to Case a non-defined variable can only lead to trouble - it seems to fire permamently.M23P.S. Please run your code through Tidy before posting - it takes 1 click in SciTE. Many people will not even look at scruffily fomatted code like yours ;-) Edited January 31, 2009 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
KaFu Posted January 31, 2009 Share Posted January 31, 2009 It's because $MyButton2 (NULL) = $nMsg... and btw, please expandcollapse popup#include <GUIConstants.au3> #include<WindowsConstants.au3> Global $f_Run = False, $f_AnyChecked = False Global $Form1 = GUICreate("Form1", 625, 444, 189, 146) $Pic1 = GUICtrlCreatePic("C:\Users\Snoopy\Desktop\toontown%20awesome%20picture.jpg", 0, 0, 625, 441, 0) GUISetState($GUI_DISABLE) GUICtrlSetState($Pic1, $GUI_DISABLE) Global $Credits = GUICtrlCreateButton("Credits", 0, 0, 153, 65, 0) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") Global $MyButton1 = GUICtrlCreateButton("Start", 520, 0, 100, 30, 0) GUICtrlSetFont(-1, 15, 800, 0, "MS Serif") GUICtrlSetBkColor(-1, 0xFFFFE1) Global $MyButton2 = GUICtrlCreateButton("...", 520, 400, 100, 30, 0) $checkbox_dummy_start = GUICtrlCreateDummy() Global $CheckBox1 = GUICtrlCreateCheckbox("Jump", 520, 32, 100, 30, 0) Global $CheckBox2 = GUICtrlCreateCheckbox("Beg", 520, 72, 100, 30, 0) Global $CheckBox3 = GUICtrlCreateCheckbox("Say", 520, 112, 100, 30, 0) Global $CheckBox4 = GUICtrlCreateCheckbox("Roallover", 520, 160, 100, 30, 0) $checkbox_dummy_end = GUICtrlCreateDummy() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Credits MsgBox(64, "Credits", "Matthew Povolotski, Toon:Sniffy Macnose") Case $MyButton1 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False If BitAND(GUICtrlRead($CheckBox1), $GUI_CHECKED) Then $f_AnyChecked = True Local $randomcoords[7][2] = [[210, 62],[200, 77],[200, 93],[200, 108],[200, 124],[200, 139],[200, 156]] $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, 0xB4EC8F) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf Sleep(100) $pixelSearch = PixelSearch(153, 62, @DesktopWidth, @DesktopHeight, 0x080999) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf $r = Random(0, 6, 1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) EndIf WEnd Case $MyButton2 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False If BitAND(GUICtrlRead($CheckBox2), $GUI_CHECKED) Then $f_AnyChecked = True Local $randomcoords[7][2] = [[289, 83],[200, 77],[200, 93],[200, 108],[200, 124],[200, 139],[200, 156]] $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, 0xB4EC8F) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf Sleep(100) $pixelSearch = PixelSearch(153, 62, @DesktopWidth, @DesktopHeight, 0x080999) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf $r = Random(0, 6, 1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) EndIf If BitAND(GUICtrlRead($CheckBox3), $GUI_CHECKED) Then $f_AnyChecked = True MsgBox(64, "Checkbox 3", "CheckBox 3 is checked", 1) EndIf If BitAND(GUICtrlRead($CheckBox4), $GUI_CHECKED) Then $f_AnyChecked = True MsgBox(64, "Checkbox 4", "CheckBox 4 is checked", 1) EndIf If Not $f_AnyChecked Then ExitLoop WEnd HotKeySet("{F5}") EndSwitch WEnd Func _StopIt() $f_Run = False EndFunc ;==>_StopIt Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF) Switch $iIDFrom Case $checkbox_dummy_start To $checkbox_dummy_end For $i = $checkbox_dummy_start To $checkbox_dummy_end If $i <> $iIDFrom Then GUICtrlSetState($i, 4) Next EndSwitch EndFunc ;==>WM_COMMAND OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
snoopy Posted January 31, 2009 Author Share Posted January 31, 2009 snoopy,$MyButton2 is declared at the beginning, but is never given a value or created in the rest of your script.What is $MyButton2 for? Why is it in your GUIGetMsg loop if it does not exist? I am pretty sure that this is the cause of your problem as trying to Case a non-defined variable can only lead to trouble - it seems to fire permamently.M23P.S. Please run your code through Tidy before posting - it takes 1 click in SciTE. Many people will not even look at scruffily fomatted code like yours ;-)ahh man tnx i dident notice that, i will allways remmember this one , tnx again ;P Link to comment Share on other sites More sharing options...
snoopy Posted January 31, 2009 Author Share Posted January 31, 2009 It's because $MyButton2 (NULL) = $nMsg... and btw, please expandcollapse popup#include <GUIConstants.au3> #include<WindowsConstants.au3> Global $f_Run = False, $f_AnyChecked = False Global $Form1 = GUICreate("Form1", 625, 444, 189, 146) $Pic1 = GUICtrlCreatePic("C:\Users\Snoopy\Desktop\toontown%20awesome%20picture.jpg", 0, 0, 625, 441, 0) GUISetState($GUI_DISABLE) GUICtrlSetState($Pic1, $GUI_DISABLE) Global $Credits = GUICtrlCreateButton("Credits", 0, 0, 153, 65, 0) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") Global $MyButton1 = GUICtrlCreateButton("Start", 520, 0, 100, 30, 0) GUICtrlSetFont(-1, 15, 800, 0, "MS Serif") GUICtrlSetBkColor(-1, 0xFFFFE1) Global $MyButton2 = GUICtrlCreateButton("...", 520, 400, 100, 30, 0) $checkbox_dummy_start = GUICtrlCreateDummy() Global $CheckBox1 = GUICtrlCreateCheckbox("Jump", 520, 32, 100, 30, 0) Global $CheckBox2 = GUICtrlCreateCheckbox("Beg", 520, 72, 100, 30, 0) Global $CheckBox3 = GUICtrlCreateCheckbox("Say", 520, 112, 100, 30, 0) Global $CheckBox4 = GUICtrlCreateCheckbox("Roallover", 520, 160, 100, 30, 0) $checkbox_dummy_end = GUICtrlCreateDummy() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Credits MsgBox(64, "Credits", "Matthew Povolotski, Toon:Sniffy Macnose") Case $MyButton1 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False If BitAND(GUICtrlRead($CheckBox1), $GUI_CHECKED) Then $f_AnyChecked = True Local $randomcoords[7][2] = [[210, 62],[200, 77],[200, 93],[200, 108],[200, 124],[200, 139],[200, 156]] $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, 0xB4EC8F) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf Sleep(100) $pixelSearch = PixelSearch(153, 62, @DesktopWidth, @DesktopHeight, 0x080999) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf $r = Random(0, 6, 1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) EndIf WEnd Case $MyButton2 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False If BitAND(GUICtrlRead($CheckBox2), $GUI_CHECKED) Then $f_AnyChecked = True Local $randomcoords[7][2] = [[289, 83],[200, 77],[200, 93],[200, 108],[200, 124],[200, 139],[200, 156]] $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, 0xB4EC8F) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf Sleep(100) $pixelSearch = PixelSearch(153, 62, @DesktopWidth, @DesktopHeight, 0x080999) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf $r = Random(0, 6, 1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) EndIf If BitAND(GUICtrlRead($CheckBox3), $GUI_CHECKED) Then $f_AnyChecked = True MsgBox(64, "Checkbox 3", "CheckBox 3 is checked", 1) EndIf If BitAND(GUICtrlRead($CheckBox4), $GUI_CHECKED) Then $f_AnyChecked = True MsgBox(64, "Checkbox 4", "CheckBox 4 is checked", 1) EndIf If Not $f_AnyChecked Then ExitLoop WEnd HotKeySet("{F5}") EndSwitch WEnd Func _StopIt() $f_Run = False EndFunc ;==>_StopIt Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF) Switch $iIDFrom Case $checkbox_dummy_start To $checkbox_dummy_end For $i = $checkbox_dummy_start To $checkbox_dummy_end If $i <> $iIDFrom Then GUICtrlSetState($i, 4) Next EndSwitch EndFunc ;==>WM_COMMANDnow the Beg command doesnt take any effect when is clicked and click start -.- how come? Link to comment Share on other sites More sharing options...
snoopy Posted January 31, 2009 Author Share Posted January 31, 2009 Global $MyButton2 = GUICtrlCreateButton("...", 520, 400, 100, 30, 0) whats the point of doing that when i got the beg button allredy? i allredy got beg button... i want it to be under my beg button wich is $MyButton2 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2009 Moderators Share Posted January 31, 2009 snoopy, Are you trying to run just 1 command at a time? If so, think about making a group of radio buttons rather than 4 checkboxes. Then only one of them can be checked at a time and all you need to do is work out which one. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
KaFu Posted January 31, 2009 Share Posted January 31, 2009 whats the point of doing that when i got the beg button allredy? i allredy got beg button... i want it to be under my beg button wich is $MyButton2You defined Case $MyButton2That's why I assumed that you're not finished with the script and wanted a second button, why else define Case $MyButton2? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
snoopy Posted January 31, 2009 Author Share Posted January 31, 2009 (edited) You defined Case $MyButton2That's why I assumed that you're not finished with the script and wanted a second button, why else define Case $MyButton2?thanks for tips , and you are right...but if i will change it to radios , do i leave the find colour and mouse clics same ? and just change the $buttons? Edited January 31, 2009 by snoopy Link to comment Share on other sites More sharing options...
snoopy Posted January 31, 2009 Author Share Posted January 31, 2009 (edited) e.g. expandcollapse popup#include <GUIConstants.au3> #include<WindowsConstants.au3> Global $f_Run = False, $f_AnyChecked = False Global $Form1 = GUICreate("Form1", 625, 444, 189, 146) $Pic1 = GUICtrlCreatePic("C:\Users\Snoopy\Desktop\toontown%20awesome%20picture.jpg", 0, 0, 625, 441, 0) GUISetState($GUI_DISABLE) GUICtrlSetState($Pic1, $GUI_DISABLE) Global $Credits = GUICtrlCreateButton("Credits", 0, 0, 153, 65, 0) GUICtrlSetFont(-1, 20, 400, 0, "MS Sans Serif") Global $radio1 = GUICtrlCreateButton("Start", 520, 0, 100, 30, 0) GUICtrlSetFont(-1, 15, 800, 0, "MS Serif") GUICtrlSetBkColor(-1, 0xFFFFE1) Global $radio2 = GUICtrlCreateButton("...", 520, 400, 100, 30, 0) $radio_dummy_start = GUICtrlCreateDummy() Global $radio1 = GUICtrlCreateRadio("Jump", 520, 32, 100, 30, 0) Global $radio2 = GUICtrlCreateRadio("Beg", 520, 72, 100, 30, 0) Global $radio3 = GUICtrlCreateRadio("Say", 520, 112, 100, 30, 0) Global $radio4 = GUICtrlCreateRadio("Roallover", 520, 160, 100, 30, 0) $radio_dummy_end = GUICtrlCreateDummy() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Credits MsgBox(64, "Credits", "Matthew Povolotski, Toon:Sniffy Macnose") Case $radio1 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False If BitAND(GUICtrlRead($radio1), $GUI_CHECKED) Then $f_AnyChecked = True Local $randomcoords[7][2] = [[210, 62],[200, 77],[200, 93],[200, 108],[200, 124],[200, 139],[200, 156]] $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, 0xB4EC8F) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf Sleep(100) $pixelSearch = PixelSearch(153, 62, @DesktopWidth, @DesktopHeight, 0x080999) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf $r = Random(0, 6, 1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) EndIf WEnd Case $radio2 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False If BitAND(GUICtrlRead($radio2), $GUI_CHECKED) Then $f_AnyChecked = True Local $randomcoords[7][2] = [[289, 83],[200, 77],[200, 93],[200, 108],[200, 124],[200, 139],[200, 156]] $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, 0xB4EC8F) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf Sleep(100) $pixelSearch = PixelSearch(153, 62, @DesktopWidth, @DesktopHeight, 0x080999) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf $r = Random(0, 6, 1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) EndIf If BitAND(GUICtrlRead($radio3), $GUI_CHECKED) Then $f_AnyChecked = True MsgBox(64, "radio 3", "radio 3 is checked", 1) EndIf If BitAND(GUICtrlRead($radio4), $GUI_CHECKED) Then $f_AnyChecked = True MsgBox(64, "radio 4", "radio 4 is checked", 1) EndIf If Not $f_AnyChecked Then ExitLoop WEnd HotKeySet("{F5}") EndSwitch WEnd Func _StopIt() $f_Run = False EndFunc ;==>_StopIt Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0xFFFF) Switch $iIDFrom Case $radio_dummy_start To $radio_dummy_end For $i = $radio_dummy_start To $radio_dummy_end If $i <> $iIDFrom Then GUICtrlSetState($i, 4) Next EndSwitch EndFunc ;==>WM_COMMAND Edited January 31, 2009 by snoopy Link to comment Share on other sites More sharing options...
snoopy Posted January 31, 2009 Author Share Posted January 31, 2009 You defined Case $MyButton2That's why I assumed that you're not finished with the script and wanted a second button, why else define Case $MyButton2?you are pro, i am nooob thats why Link to comment Share on other sites More sharing options...
snoopy Posted January 31, 2009 Author Share Posted January 31, 2009 (edited) ok so i changed it to radio's,,, works 100% but again when i press it , it starts stright away, and i want to click it and than click start and than itll run how do i do that? Edited January 31, 2009 by snoopy Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2009 Moderators Share Posted January 31, 2009 snoopy, Play around with this:expandcollapse popup#include <GUIConstants.au3> #include<WindowsConstants.au3> Global $f_Run = False, $f_AnyChecked = False Global $Form1 = GUICreate("Form1", 625, 444, 189, 146) Global $MyButton1 = GUICtrlCreateButton("Start", 520, 0, 100, 30, 0) GUICtrlSetFont(-1, 15, 800, 0, "MS Serif") GUICtrlSetBkColor(-1, 0xFFFFE1) ; Create box GUICtrlCreateGroup ( "Actions", 500, 30, 125, 170) Opt("GUICoordMode",0); Relative coords $hRadio1 = GUICtrlCreateRadio("Jump", 10, 20, 130, 30) $hRadio2 = GUICtrlCreateRadio("Beg", -1, 30, 130, 30) $hRadio3 = GUICtrlCreateRadio("Say", -1, 30, 130, 30) $hRadio4 = GUICtrlCreateRadio("RollOver", -1, 30, 130, 30) Opt("GUICoordMode",1); GUI coords GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MyButton1 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False For $i = $hRadio1 To $hRadio1 + 3 If BitAND(GUICtrlRead($i), $GUI_CHECKED) = $GUI_CHECKED Then ConsoleWrite($i & @CRLF); Run your code for that radio EndIf Next WEnd HotKeySet("{F5}") EndSwitch WEnd Func _StopIt() $f_Run = False EndFunc ;==>_StopIt For me it waits until a radio is checked and then continues to write to the console until F5 is pressed. All you have to do is to run the correct code for each radio button when it is checked. But I am sure you can do that ;-) M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
snoopy Posted January 31, 2009 Author Share Posted January 31, 2009 E.g? expandcollapse popup#include <GUIConstants.au3> #include<WindowsConstants.au3> Global $f_Run = False, $f_AnyChecked = False Global $Form1 = GUICreate("Form1", 625, 444, 189, 146) Global $MyButton1 = GUICtrlCreateButton("Start", 520, 0, 100, 30, 0) GUICtrlSetFont(-1, 15, 800, 0, "MS Serif") GUICtrlSetBkColor(-1, 0xFFFFE1) ; Create box GUICtrlCreateGroup ( "Actions", 500, 30, 125, 170) Opt("GUICoordMode",0); Relative coords $hRadio1 = GUICtrlCreateRadio("Jump", 10, 20, 130, 30) $hRadio2 = GUICtrlCreateRadio("Beg", -1, 30, 130, 30) $hRadio3 = GUICtrlCreateRadio("Say", -1, 30, 130, 30) $hRadio4 = GUICtrlCreateRadio("RollOver", -1, 30, 130, 30) Opt("GUICoordMode",1); GUI coords GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MyButton1 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False For $i = $hRadio1 To $hRadio1 + 3 If BitAND(GUICtrlRead($i), $GUI_CHECKED) = $GUI_CHECKED Then $f_AnyChecked = True Local $randomcoords[7][2] = [[210, 62],[200, 77],[200, 93],[200, 108],[200, 124],[200, 139],[200, 156]] $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, 0xB4EC8F) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf Sleep(100) $pixelSearch = PixelSearch(153, 62, @DesktopWidth, @DesktopHeight, 0x080999) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf $r = Random(0, 6, 1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) ConsoleWrite($i & @CRLF); Run your code for that radio EndIf Next Local $randomcoords[7][2] = [[289,83],[200, 77],[200, 93],[200, 108],[200, 124],[200, 139],[200, 156]] $pixelSearch = PixelSearch(57, 45, @DesktopWidth, @DesktopHeight, 0xB4EC8F) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf Sleep(100) $pixelSearch = PixelSearch(153, 62, @DesktopWidth, @DesktopHeight, 0x080999) If IsArray($pixelSearch) = 1 Then MouseClick("left", $pixelSearch[0], $pixelSearch[1], 1, 0) EndIf $r = Random(0, 6, 1) MouseClick("left", $randomcoords[$r][0], $randomcoords[$r][1], 1) ConsoleWrite($i & @CRLF); Run your code for that radio WEnd HotKeySet("{F5}") EndSwitch WEnd Func _StopIt() $f_Run = False EndFunc ;==>_StopIt works 100% but after next... it means that the seccond button will act the following? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 31, 2009 Moderators Share Posted January 31, 2009 snoopy,You have not understood the code I posted. The For...Next loop works out which radio is checked. You then have to decide what code to run. I would do something like this:expandcollapse popup#include <GUIConstants.au3> #include<WindowsConstants.au3> Global $f_Run = False, $f_AnyChecked = False Global $Form1 = GUICreate("Form1", 625, 444, 189, 146) Global $MyButton1 = GUICtrlCreateButton("Start", 520, 0, 100, 30, 0) GUICtrlSetFont(-1, 15, 800, 0, "MS Serif") GUICtrlSetBkColor(-1, 0xFFFFE1) ; Create box GUICtrlCreateGroup ( "Actions", 500, 30, 125, 170) Opt("GUICoordMode",0); Relative coords $hRadio1 = GUICtrlCreateRadio("Jump", 10, 20, 130, 30) $hRadio2 = GUICtrlCreateRadio("Beg", -1, 30, 130, 30) $hRadio3 = GUICtrlCreateRadio("Say", -1, 30, 130, 30) $hRadio4 = GUICtrlCreateRadio("RollOver", -1, 30, 130, 30) Opt("GUICoordMode",1); GUI coords GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MyButton1 HotKeySet("{F5}", "_StopIt") $f_Run = True While $f_Run $f_AnyChecked = False For $i = $hRadio1 To $hRadio1 + 3 If BitAND(GUICtrlRead($i), $GUI_CHECKED) = $GUI_CHECKED Then $Ispressed = $i - $hRadio1 + 1; $Ispressed is now the number of the radio ExitLoop ; Get out of the For...Next loop EndIf Next Switch $Ispressed Case 1 ; code or function for what to do if "Jump" checked Case 2 ; code or function for what to do if "Beg" checked Case 3 ; code or function for what to do if "Say" checked Case 4 ; code or function for what to do if "RollOver" checked EndSwitch WEnd HotKeySet("{F5}") EndSwitch WEnd Func _StopIt() $f_Run = False EndFunc ;==>_StopItYou will have to look at how you get out of the various sections of the Switch..Case - perhaps a test of $fRun. I am afraid that you may have to do quite a bit of rewriting - as the old saying goes: "If you want to get there, you should not be starting from here!" - and your existing code might not be the best suited to what you now want to do. But I am sure you can come up with something which works. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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