Sign in to follow this  
Followers 0
mrtgtr

Some work at the same time

7 posts in this topic

#1 ·  Posted (edited)

Hi, I have some check box and I am trying to the box has been selected by than I will start with button.

I will select two box , three box , 1 box , maybe I will choose all but I cant it -_-

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\mert\Desktop\SON.kxf
$Firefox = GUICreate("Travian comx - Mozilla Firefox", 347, 247, 192, 124)
GUISetIcon("C:\Users\mert\Desktop\Firefox.ico", -1)
GUISetFont(12, 800, 0, "Trebuchet MS")
$HPBOX = GUICtrlCreateCheckbox("HP", 32, 24, 97, 17)
$MANABOX = GUICtrlCreateCheckbox("MANA", 32, 56, 97, 17)
$BUFBOX = GUICtrlCreateCheckbox("BUF", 32, 88, 97, 17)
$SPRINTBOX = GUICtrlCreateCheckbox("SPRINT", 32, 120, 97, 17)
$TOPLUCEKBOX = GUICtrlCreateCheckbox("TOPLUÇEK", 224, 48, 105, 33)
$CEKBOX = GUICtrlCreateCheckbox("ÇEK", 224, 96, 81, 25)
$ATAKBOX = GUICtrlCreateCheckbox("ATAK", 136, 80, 97, 17)
$BASLA = GUICtrlCreateButton("BAŞLA", 72, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
$DUR = GUICtrlCreateButton("DUR", 184, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $Paused

HotKeySet("{Home}", "TogglePause")

HotKeySet("{End}", "Stop") ;script can be stopped by pressing -

Sleep(2000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BASLA

        Runner()

        EndSwitch
WEnd

Func TogglePause()
$Paused = not $Paused
While $Paused
sleep(100)
WEnd
EndFunc

Func Stop() ;to allow the script to stop
Exit ;same
EndFunc ;same


;KOXP FONKSİYONLARI

Func Runner()
    While 1
        If
        GUICtrlRead($HPBOX) = 1 Then

        PixelSearch( 160, 67, 160, 67, 0x000000 )
            If Not @error Then
            Send("{1 down}")
            sleep(50)
            Send("{1 up}")

            If
        GUICtrlRead($MANABOX) = 1 Then

        PixelSearch( 160, 84, 160, 84, 0x000000 )
            If Not @error Then
            Send("{2 down}")
            sleep(50)
            Send("{2 up}")

            If
         GUICtrlRead($BUFBOX) = 1 Then

        PixelSearch(  840+32=1000, 136,  840+32=1000, 136, 0xB8B801 )
            If @error Then
            Send("{0 down}")
            sleep(75)
            Send("{0 up}")

            If
        GUICtrlRead($SPRINTBOX) = 1 Then

        send("5")

            If
        GUICtrlRead($ATAKBOX) = 1 Then

        send("Z4")

            If
         GUICtrlRead($CEKBOX) = 1 Then

        PixelSearch( 838, 714, 838, 714, 0xFFFF00 )
        PixelSearch( 836, 709, 836, 709, 0xFFFF00 )
        PixelSearch( 832, 711, 832, 711, 0xFFFF00 )
        PixelSearch( 829, 714, 829, 714, 0xFFFF00 )
        PixelSearch( 829, 714, 829, 714, 0xB8B801 )
        PixelSearch(  59, 395,  59, 405, 0xB8B801 )
        If Not @error Then
            Send("7")

            If
        GUICtrlRead($TOPLUCEKBOX) = 1 Then

        PixelSearch( 838, 714, 838, 714, 0xFFFF00 )
        PixelSearch( 836, 709, 836, 709, 0xFFFF00 )
        PixelSearch( 832, 711, 832, 711, 0xFFFF00 )
        PixelSearch( 829, 714, 829, 714, 0xFFFF00 )
        PixelSearch( 829, 714, 829, 714, 0xB8B801 )
        PixelSearch(  59, 395,  59, 405, 0xB8B801 )
        If Not @error Then
            Send("{8 down}")
            Sleep(75)
            Send("{8 up}")
            MouseMove(530, 780)
            MouseDown("left")
            Sleep(100)
            MouseUp("left")
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf

    WEnd
EndFunc
Edited by mrtgtr

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

wrong nested If Then Endif in your script.

maybe like this ?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=C:\Users\mert\Desktop\SON.kxf
$Firefox = GUICreate("Travian comx - Mozilla Firefox", 347, 247, 192, 124)
GUISetIcon("C:\Users\mert\Desktop\Firefox.ico", -1)
GUISetFont(12, 800, 0, "Trebuchet MS")
$HPBOX = GUICtrlCreateCheckbox("HP", 32, 24, 97, 17)
$MANABOX = GUICtrlCreateCheckbox("MANA", 32, 56, 97, 17)
$BUFBOX = GUICtrlCreateCheckbox("BUF", 32, 88, 97, 17)
$SPRINTBOX = GUICtrlCreateCheckbox("SPRINT", 32, 120, 97, 17)
$TOPLUCEKBOX = GUICtrlCreateCheckbox("TOPLUÇEK", 224, 48, 105, 33)
$CEKBOX = GUICtrlCreateCheckbox("ÇEK", 224, 96, 81, 25)
$ATAKBOX = GUICtrlCreateCheckbox("ATAK", 136, 80, 97, 17)
$BASLA = GUICtrlCreateButton("BASLA", 72, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
$DUR = GUICtrlCreateButton("DUR", 184, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

Global $Paused

HotKeySet("{Home}", "TogglePause")

HotKeySet("{End}", "Stop") ;script can be stopped by pressing -

Sleep(2000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BASLA

            Runner()

    EndSwitch
WEnd

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
    WEnd
EndFunc   ;==>TogglePause

Func Stop() ;to allow the script to stop
    Exit ;same
EndFunc   ;==>Stop


;KOXP FONKSIYONLARI

Func Runner()
    While 1
        If GUICtrlRead($HPBOX) = 1 Then

            PixelSearch(160, 67, 160, 67, 0x000000)
            If Not @error Then
                Send("{1 down}")
                Sleep(50)
                Send("{1 up}")
            EndIf
        EndIf

        If GUICtrlRead($MANABOX) = 1 Then

            PixelSearch(160, 84, 160, 84, 0x000000)
            If Not @error Then
                Send("{2 down}")
                Sleep(50)
                Send("{2 up}")

            EndIf
        EndIf

        If GUICtrlRead($BUFBOX) = 1 Then

            PixelSearch(840 + 32 = 1000, 136, 840 + 32 = 1000, 136, 0xB8B801)
            If @error Then
                Send("{0 down}")
                Sleep(75)
                Send("{0 up}")
            EndIf
        EndIf

        If GUICtrlRead($SPRINTBOX) = 1 Then

            Send("5")
        EndIf

        If GUICtrlRead($ATAKBOX) = 1 Then

            Send("Z4")
        EndIf

        If GUICtrlRead($CEKBOX) = 1 Then

            PixelSearch(838, 714, 838, 714, 0xFFFF00)
            PixelSearch(836, 709, 836, 709, 0xFFFF00)
            PixelSearch(832, 711, 832, 711, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xB8B801)
            PixelSearch(59, 395, 59, 405, 0xB8B801)
        EndIf
        If Not @error Then
            Send("7")
        EndIf

        If GUICtrlRead($TOPLUCEKBOX) = 1 Then

            PixelSearch(838, 714, 838, 714, 0xFFFF00)
            PixelSearch(836, 709, 836, 709, 0xFFFF00)
            PixelSearch(832, 711, 832, 711, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xB8B801)
            PixelSearch(59, 395, 59, 405, 0xB8B801)
        EndIf

        If Not @error Then
            Send("{8 down}")
            Sleep(75)
            Send("{8 up}")
            MouseMove(530, 780)
            MouseDown("left")
            Sleep(100)
            MouseUp("left")
        EndIf
    WEnd
EndFunc   ;==>Runner
Edited by PincoPanco

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

 

wrong nested If Then Endif in your script.

maybe like this ?

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=C:\Users\mert\Desktop\SON.kxf
$Firefox = GUICreate("Travian comx - Mozilla Firefox", 347, 247, 192, 124)
GUISetIcon("C:\Users\mert\Desktop\Firefox.ico", -1)
GUISetFont(12, 800, 0, "Trebuchet MS")
$HPBOX = GUICtrlCreateCheckbox("HP", 32, 24, 97, 17)
$MANABOX = GUICtrlCreateCheckbox("MANA", 32, 56, 97, 17)
$BUFBOX = GUICtrlCreateCheckbox("BUF", 32, 88, 97, 17)
$SPRINTBOX = GUICtrlCreateCheckbox("SPRINT", 32, 120, 97, 17)
$TOPLUCEKBOX = GUICtrlCreateCheckbox("TOPLUÇEK", 224, 48, 105, 33)
$CEKBOX = GUICtrlCreateCheckbox("ÇEK", 224, 96, 81, 25)
$ATAKBOX = GUICtrlCreateCheckbox("ATAK", 136, 80, 97, 17)
$BASLA = GUICtrlCreateButton("BASLA", 72, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
$DUR = GUICtrlCreateButton("DUR", 184, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

Global $Paused

HotKeySet("{Home}", "TogglePause")

HotKeySet("{End}", "Stop") ;script can be stopped by pressing -

Sleep(2000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BASLA

            Runner()

    EndSwitch
WEnd

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
    WEnd
EndFunc   ;==>TogglePause

Func Stop() ;to allow the script to stop
    Exit ;same
EndFunc   ;==>Stop


;KOXP FONKSIYONLARI

Func Runner()
    While 1
        If GUICtrlRead($HPBOX) = 1 Then

            PixelSearch(160, 67, 160, 67, 0x000000)
            If Not @error Then
                Send("{1 down}")
                Sleep(50)
                Send("{1 up}")
            EndIf
        EndIf

        If GUICtrlRead($MANABOX) = 1 Then

            PixelSearch(160, 84, 160, 84, 0x000000)
            If Not @error Then
                Send("{2 down}")
                Sleep(50)
                Send("{2 up}")

            EndIf
        EndIf

        If GUICtrlRead($BUFBOX) = 1 Then

            PixelSearch(840 + 32 = 1000, 136, 840 + 32 = 1000, 136, 0xB8B801)
            If @error Then
                Send("{0 down}")
                Sleep(75)
                Send("{0 up}")
            EndIf
        EndIf

        If GUICtrlRead($SPRINTBOX) = 1 Then

            Send("5")
        EndIf

        If GUICtrlRead($ATAKBOX) = 1 Then

            Send("Z4")
        EndIf

        If GUICtrlRead($CEKBOX) = 1 Then

            PixelSearch(838, 714, 838, 714, 0xFFFF00)
            PixelSearch(836, 709, 836, 709, 0xFFFF00)
            PixelSearch(832, 711, 832, 711, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xB8B801)
            PixelSearch(59, 395, 59, 405, 0xB8B801)
        EndIf
        If Not @error Then
            Send("7")
        EndIf

        If GUICtrlRead($TOPLUCEKBOX) = 1 Then

            PixelSearch(838, 714, 838, 714, 0xFFFF00)
            PixelSearch(836, 709, 836, 709, 0xFFFF00)
            PixelSearch(832, 711, 832, 711, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xB8B801)
            PixelSearch(59, 395, 59, 405, 0xB8B801)
        EndIf

        If Not @error Then
            Send("{8 down}")
            Sleep(75)
            Send("{8 up}")
            MouseMove(530, 780)
            MouseDown("left")
            Sleep(100)
            MouseUp("left")
        EndIf
    WEnd
EndFunc   ;==>Runner

 

Thanx but I want to run script according to the checkbox, I told

I want to run script according to any checkbox or two checkbox or three checkbox or four checkbox or five checkbox or six checkbox or seven checkbox
 
Sorry for my funny english :DDDDD

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

the blocks of code between If GUICtrlRead ($xxxxxx) = 1 Then and endif are executed only if the corresponding checkboxes  are checked.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=C:\Users\mert\Desktop\SON.kxf
$Firefox = GUICreate("Travian comx - Mozilla Firefox", 347, 247, 192, 124)
GUISetIcon("C:\Users\mert\Desktop\Firefox.ico", -1)
GUISetFont(12, 800, 0, "Trebuchet MS")
$HPBOX = GUICtrlCreateCheckbox("HP", 32, 24, 97, 17)
$MANABOX = GUICtrlCreateCheckbox("MANA", 32, 56, 97, 17)
$BUFBOX = GUICtrlCreateCheckbox("BUF", 32, 88, 97, 17)
$SPRINTBOX = GUICtrlCreateCheckbox("SPRINT", 32, 120, 97, 17)
$TOPLUCEKBOX = GUICtrlCreateCheckbox("TOPLUÇEK", 224, 48, 105, 33)
$CEKBOX = GUICtrlCreateCheckbox("ÇEK", 224, 96, 81, 25)
$ATAKBOX = GUICtrlCreateCheckbox("ATAK", 136, 80, 97, 17)
$BASLA = GUICtrlCreateButton("BASLA", 72, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
$DUR = GUICtrlCreateButton("DUR", 184, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
MsgBox(0, "", $GUI_CHECKED)
Global $Paused

HotKeySet("{Home}", "TogglePause")

HotKeySet("{End}", "Stop") ;script can be stopped by pressing -

Sleep(2000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BASLA

            Runner()

    EndSwitch
WEnd

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
    WEnd
EndFunc   ;==>TogglePause

Func Stop() ;to allow the script to stop
    Exit ;same
EndFunc   ;==>Stop

;KOXP FONKSIYONLARI

Func Runner()
    While 1
        If GUICtrlRead($HPBOX) = 1 Then
            PixelSearch(160, 67, 160, 67, 0x000000)
            If Not @error Then
                Send("{1 down}")
                Sleep(50)
                Send("{1 up}")
            EndIf
        EndIf

        If GUICtrlRead($MANABOX) = 1 Then
            PixelSearch(160, 84, 160, 84, 0x000000)
            If Not @error Then
                Send("{2 down}")
                Sleep(50)
                Send("{2 up}")
            EndIf
        EndIf

        If GUICtrlRead($BUFBOX) = 1 Then
            PixelSearch(840 + 32 = 1000, 136, 840 + 32 = 1000, 136, 0xB8B801)
            If @error Then
                Send("{0 down}")
                Sleep(75)
                Send("{0 up}")
            EndIf
        EndIf

        If GUICtrlRead($SPRINTBOX) = 1 Then
            Send("5")
        EndIf

        If GUICtrlRead($ATAKBOX) = 1 Then
            Send("Z4")
        EndIf

        If GUICtrlRead($CEKBOX) = 1 Then
            PixelSearch(838, 714, 838, 714, 0xFFFF00)
            PixelSearch(836, 709, 836, 709, 0xFFFF00)
            PixelSearch(832, 711, 832, 711, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xB8B801)
            PixelSearch(59, 395, 59, 405, 0xB8B801)
            If Not @error Then
                Send("7")
            EndIf
        EndIf

        If GUICtrlRead($TOPLUCEKBOX) = 1 Then
            PixelSearch(838, 714, 838, 714, 0xFFFF00)
            PixelSearch(836, 709, 836, 709, 0xFFFF00)
            PixelSearch(832, 711, 832, 711, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xB8B801)
            PixelSearch(59, 395, 59, 405, 0xB8B801)
            If Not @error Then
                Send("{8 down}")
                Sleep(75)
                Send("{8 up}")
                MouseMove(530, 780)
                MouseDown("left")
                Sleep(100)
                MouseUp("left")
            EndIf
        EndIf
    WEnd
EndFunc   ;==>Runner
Edited by PincoPanco

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

 

the blocks of code between If GUICtrlRead ($xxxxxx) = 1 Then and endif are executed only if the corresponding checkboxes  are checked.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=C:\Users\mert\Desktop\SON.kxf
$Firefox = GUICreate("Travian comx - Mozilla Firefox", 347, 247, 192, 124)
GUISetIcon("C:\Users\mert\Desktop\Firefox.ico", -1)
GUISetFont(12, 800, 0, "Trebuchet MS")
$HPBOX = GUICtrlCreateCheckbox("HP", 32, 24, 97, 17)
$MANABOX = GUICtrlCreateCheckbox("MANA", 32, 56, 97, 17)
$BUFBOX = GUICtrlCreateCheckbox("BUF", 32, 88, 97, 17)
$SPRINTBOX = GUICtrlCreateCheckbox("SPRINT", 32, 120, 97, 17)
$TOPLUCEKBOX = GUICtrlCreateCheckbox("TOPLUÇEK", 224, 48, 105, 33)
$CEKBOX = GUICtrlCreateCheckbox("ÇEK", 224, 96, 81, 25)
$ATAKBOX = GUICtrlCreateCheckbox("ATAK", 136, 80, 97, 17)
$BASLA = GUICtrlCreateButton("BASLA", 72, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
$DUR = GUICtrlCreateButton("DUR", 184, 176, 75, 25)
GUICtrlSetFont(-1, 10, 800, 0, "Trebuchet MS")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
MsgBox(0, "", $GUI_CHECKED)
Global $Paused

HotKeySet("{Home}", "TogglePause")

HotKeySet("{End}", "Stop") ;script can be stopped by pressing -

Sleep(2000) ;wait some time before starting the Script cycle, to allow the user to navigate to the correct window

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $BASLA

            Runner()

    EndSwitch
WEnd

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
    WEnd
EndFunc   ;==>TogglePause

Func Stop() ;to allow the script to stop
    Exit ;same
EndFunc   ;==>Stop

;KOXP FONKSIYONLARI

Func Runner()
    While 1
        If GUICtrlRead($HPBOX) = 1 Then
            PixelSearch(160, 67, 160, 67, 0x000000)
            If Not @error Then
                Send("{1 down}")
                Sleep(50)
                Send("{1 up}")
            EndIf
        EndIf

        If GUICtrlRead($MANABOX) = 1 Then
            PixelSearch(160, 84, 160, 84, 0x000000)
            If Not @error Then
                Send("{2 down}")
                Sleep(50)
                Send("{2 up}")
            EndIf
        EndIf

        If GUICtrlRead($BUFBOX) = 1 Then
            PixelSearch(840 + 32 = 1000, 136, 840 + 32 = 1000, 136, 0xB8B801)
            If @error Then
                Send("{0 down}")
                Sleep(75)
                Send("{0 up}")
            EndIf
        EndIf

        If GUICtrlRead($SPRINTBOX) = 1 Then
            Send("5")
        EndIf

        If GUICtrlRead($ATAKBOX) = 1 Then
            Send("Z4")
        EndIf

        If GUICtrlRead($CEKBOX) = 1 Then
            PixelSearch(838, 714, 838, 714, 0xFFFF00)
            PixelSearch(836, 709, 836, 709, 0xFFFF00)
            PixelSearch(832, 711, 832, 711, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xB8B801)
            PixelSearch(59, 395, 59, 405, 0xB8B801)
            If Not @error Then
                Send("7")
            EndIf
        EndIf

        If GUICtrlRead($TOPLUCEKBOX) = 1 Then
            PixelSearch(838, 714, 838, 714, 0xFFFF00)
            PixelSearch(836, 709, 836, 709, 0xFFFF00)
            PixelSearch(832, 711, 832, 711, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xFFFF00)
            PixelSearch(829, 714, 829, 714, 0xB8B801)
            PixelSearch(59, 395, 59, 405, 0xB8B801)
            If Not @error Then
                Send("{8 down}")
                Sleep(75)
                Send("{8 up}")
                MouseMove(530, 780)
                MouseDown("left")
                Sleep(100)
                MouseUp("left")
            EndIf
        EndIf
    WEnd
EndFunc   ;==>Runner

o man thank you so much

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0