Jump to content

on top everything -.-


snoopy
 Share

Recommended Posts

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 -.-

#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

  • Moderators

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.

M23

P.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 by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

It's because $MyButton2 (NULL) = $nMsg... and btw, please

#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
Link to comment
Share on other sites

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.

M23

P.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

It's because $MyButton2 (NULL) = $nMsg... and btw, please

#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
now the Beg command doesnt take any effect when is clicked and click start -.-

how come?

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

You defined

Case $MyButton2

That's why I assumed that you're not finished with the script and wanted a second button, why else define Case $MyButton2?

Link to comment
Share on other sites

You defined

Case $MyButton2

That'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 by snoopy
Link to comment
Share on other sites

e.g.

#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 by snoopy
Link to comment
Share on other sites

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 by snoopy
Link to comment
Share on other sites

  • Moderators

snoopy,

Play around with this:

#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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

E.g?

#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

  • Moderators

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:

#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 ;==>_StopIt

You 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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...