Jump to content

PixelSearch -> MouseClick


Rawox
 Share

Recommended Posts

It isn't working :)

I get this error:

MouseClick ( 'left', $arr[0]+30, $arr[1]+30, 1, 5 )
MouseClick ( 'left', $arr^ERROR

Error: Subscript used with non-Array variable.

Arr Variable:

Dim $arr = PixelSearch ( 200, 200, 1100, 600, 0xF0FBF8, 0, 5 )

??

Link to comment
Share on other sites

Did you verify the return value is actually array? I mean, the pixel was found in the rectangular area? (use @error or IsArray() to determine this). Again, please read carefully the help file...

Yes it is.. and I can't find it in the help file...

This is the whole code:

HotKeySet("{F4}", "ExitProg")
Opt("WinTitleMatchMode", 2)
#NoTrayIcon

; ============== VARIABLES ==============

Dim $arr = PixelSearch ( 200, 200, 1100, 600, 0xF0FBF8, 0, 5 )
Global $iColor1 = 0xD6DED4 ;Homepage Color
Global $iColor2 = 0xF0FBF8;Deviation Text Box Color
Global $iColor3 = 0x8A9C8E;Top Color
Global $iColor4 = 0x45584D;Logo Color
Global Const $randomsleep[50] = ['2842', '2140', '623', '12321', '1832', '5345', '8324', '8412', '120', '723', '9312', '258', '2139', '10', '9232', '5644', '523', '8392', '583', '954', '4150', '6231', '1545', '2342', '6231', '8492', '543', '1543', '2394', '2864', '3453', '234', '5232', '3125', '532', '156', '532', '3532', '2345', '185','1231', '4124', '1234', '4892', '2341', '2259', '4240', '1295', '3123', '8420' ]
Global Const $mess[50] = ['<strong><sub>Beautifull</sub></strong>', '<strong>Cool</strong> :D', '<strong><sub>Cool, cool, cool O.o :clap:</sub></strong>', '<strong><sub>Really nice done!</sub></strong>', 'Cool! This is so <strong>Great</strong> :D', '<sup>Beautifull, Cool!</sup>', '<sub>Rockin! :headbang: :XD:</sub>', 'This is nice :D :floating:', '<sub>Really nice done!</sub>', '<strong><sub>Beautifull, I do really like this piece! :giggle:</sub></strong>', '<strong><sub>Really nice done!</sub></strong>', 'Nice;) :#1:', '<sub>Very Original :w00t:</sub>', '<strong><sub>Cool :XD:</sub></strong>', 'Well Done! :wow:', '<sub> Nice :strong:</sub>', '<strong>This is just so nice!</strong>', '<strong>Amazing O.o</strong>', '<sub>Nice :D</sub>', 'This is cool! :w00t:', '<sub><strong>Well done, I am proud on you :XD:</strong></sub>', '<sub> I am Amazed :w00t: </sub>', '<strong>Cool!</strong>', '<sub> Nice :D </sub>',  '<sup><strong>Amazing :w00t:</strong></sup>',  '<sub>Beautifull</sub>', '<sub>:wtf: This is nice!</sub>', ':teddy:', ':O_o:', '<strong>Thanks for this!</strong> :hug:', ':omfg:', ':love:', 'Cool :aww:', '<sub>So Nice</sub>:heart:', 'Nice! :dance:', '<sub>Great</sub> :boogie:', ':noes: Nice! So Cool!', ':eager: Really Cool', '<strong>Nice!</strong> :iconcheesyplzy:', ':icongrinclub: :D', '<strong><sub>Wow, Nice!</sub></strong> :iconjarryplz:', '<strong>:iconlove: This!</strong>', '<sub>So nice! I only want to say: :icontextwallplz: :D</sub>', 'Getting happy of this :icontimmy64plz:', 'Woowie! :dance:', '<sub>Really Cool</sub>', '<sub><strong>Nice, Nice, Nice!</strong></sub>', 'This is Cool :D', ':noes:<sup>It looks great!</sup>', 'Great W0rk! :XD:' ]

; ============== SCRIPT ==============

Sleep ( 100 )
ToolTip ( "Currently:   Starting Script"&@CRLF&"Made by:    Rawox" , 10, 10, "Information:", 0, 4 )
ShellExecute ( "C:\Program Files\Mozilla Firefox\firefox.exe" )
WinWaitActive ( "Firefox" )
Sleep ( 1000 )
ToolTip ( "Currently:   Going To deviantART"&@CRLF&"Made by:    Rawox" , 10, 10, "Information:", 0, 4 )
Send ( "!d" )
Sleep ( 100 )
Send ( "deviantart ^{ENTER}" )
WinWaitActive ( "deviantART" )
Sleep ( 1500 )
ToolTip ( "Currently:   Clicking 'Newest' Tab"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
MouseClick ( "left", 1072, 256, 1, 1 )
Sleep ( 2000 )
Start ()

; ============== FUNCTIONS ==============

Func Start()
        ToolTip ( "Currently:   Sleeping"&@CRLF&"Made by:   Rawox" , 10, 10, "Information:", 0, 4 )
        $rand = Random ( 0, 50 )
        Sleep ( $randomsleep[Random(0,50)] )
        Sleep ( 500 )
        ToolTip ( "Currently:   Selecting Deviation"&@CRLF&"Made by:    Rawox" , 10, 10, "Information:", 0, 4 )
        PixelSearch ( 0, 0, 600, 600, $iColor1, 0 )
    If @error Then
        ReCheckStart()
        ToolTip ( "Currently:   Searching for 2nd Time"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Commenting"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        MouseClick ( 'left', $arr[0]+30, $arr[1]+30, 1, 5 )
        Sleep ( 500 )
        Send ( "{TAB}{ENTER}" )
        WinWaitActive ( "by" )
        Sleep ( 250 )
        Deviation()
    EndIf
EndFunc

Func Deviation()
        Sleep ( 1000 )
        Send ( "{END}{END}" )

        MouseClick('left', $arr[0], $arr[1], 1, 5)
    If @error Then
        Sleep ( 2250 )
        RecheckDeviation1()
        ToolTip ( "Currently:   Searching for 2nd Time"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Commenting"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        MouseClick ( "left", 550, 481, 1, 1 )
        Sleep ( 500 )
        $rand = Random ( 0, 50 )
        Send ( $mess[Random(0,50)], 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        Sleep ( 1000 )
        CheckTop()
    EndIf
EndFunc

Func CheckTop()
        ToolTip ( "Currently:   Checking For Top"&@CRLF&"Made by:   Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        ToolTip ( "Currently:   Checking 2nd Time For Top"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 1000 )
        RecheckTop()
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc

Func DeviationLogo()
        MouseClick ( "left", 93, 301, 1, 1 )
        Sleep ( 500 )
        End()
EndFunc

Func End()
        ToolTip ( "Currently:   Restarting Script"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        WinWaitActive ( "deviantART: where ART meets application" )
        Start()
EndFunc

; ============== RECHECKS ==============

Func ReCheckStart()
        Sleep ( 1000 )
        PixelSearch ( 0, 0, 600, 600, $iColor1, 0 )
    If @error Then
        ReCheckStart1()
        ToolTip ( "Currently:   Searching for 3th Time"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        MouseClick ( "left", 205, 390, 1, 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        WinWaitActive ( "by" )
        Sleep ( 250 )
        Deviation()
    EndIf
EndFunc

Func ReCheckStart1()
        Sleep ( 1000 )
        PixelSearch ( 0, 0, 600, 600, $iColor1, 0 )
    If @error Then
        MsgBox ( 0, "Error", "Something went wrong, we're still improving this script" )
        ToolTip ( "Currently:   Error!"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        MouseClick ( "left", 205, 390, 1, 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        WinWaitActive ( "by" )
        Sleep ( 250 )
        Deviation()
    EndIf
EndFunc

Func RecheckDeviation1()
        Sleep ( 1000 )
        Send ( "{END}{END}" )
        PixelSearch ( 200, 200, 800, 800, $iColor2, 0 )
    If @error Then
        RecheckDeviation2()
        ToolTip ( "Currently:   Searching for 3th Time"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Commenting"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        MouseClick ( 'left', $arr[0]+30, $arr[1]+30, 1, 5 )
        Sleep ( 500 )
        $rand = Random ( 0, 50 )
        Send ( $mess[Random(0,50)], 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        Sleep ( 1000 )
        CheckTop()
    EndIf
EndFunc

Func RecheckDeviation2()
        Sleep ( 1000 )
        Send ( "{END}{END}" )
        PixelSearch ( 200, 200, 800, 800, $iColor2, 0 )
    If @error Then
        MsgBox ( 0, "Error", "Something went wrong, we're still improving this script" )
        ToolTip ( "Currently:   Error!"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Commenting"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        MouseClick ( 'left', $arr[0]+30, $arr[1]+30, 1, 5 )
        Sleep ( 500 )
        $rand = Random ( 0, 50 )
        Send ( $mess[Random(0,50)], 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        Sleep ( 1000 )
        CheckTop()
    EndIf
EndFunc

Func RecheckTop()
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        ToolTip ( "Currently:   Checking 3th Time For Top"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 1000 )
        RecheckTop1()
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc

Func RecheckTop1()
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        ToolTip ( "Currently:   Checking 4th Time For Top"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 1000 )
        RecheckTop2()
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc

Func RecheckTop2()
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        Sleep ( 1000 )
        RecheckTop3()
        ToolTip ( "Currently:   Checking 5th Time For Top"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc

Func RecheckTop3()
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        Sleep ( 1000 )
        MsgBox ( 0, "Error", "Something went wrong, we're still improving this script" )
        ToolTip ( "Currently:   Error!"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc


;======== EXIT FUNCTION ==============

Func ExitProg()
    ToolTip ( "Currently:   Exit in: 2 seconds"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Sleep ( 2000 )
    ToolTip ( "Currently:   Exit in: 1 second"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
    Sleep ( 1000 )
    Exit
EndFunc

It's one of my first scripts and I'm still learning :)

Link to comment
Share on other sites

Yes it is.. and I can't find it in the help file...

This is the whole code:

HotKeySet("{F4}", "ExitProg")
Opt("WinTitleMatchMode", 2)
#NoTrayIcon

; ============== VARIABLES ==============

Dim $arr = PixelSearch ( 200, 200, 1100, 600, 0xF0FBF8, 0, 5 )
Global $iColor1 = 0xD6DED4;Homepage Color
Global $iColor2 = 0xF0FBF8;Deviation Text Box Color
Global $iColor3 = 0x8A9C8E;Top Color
Global $iColor4 = 0x45584D;Logo Color
Global Const $randomsleep[50] = ['2842', '2140', '623', '12321', '1832', '5345', '8324', '8412', '120', '723', '9312', '258', '2139', '10', '9232', '5644', '523', '8392', '583', '954', '4150', '6231', '1545', '2342', '6231', '8492', '543', '1543', '2394', '2864', '3453', '234', '5232', '3125', '532', '156', '532', '3532', '2345', '185','1231', '4124', '1234', '4892', '2341', '2259', '4240', '1295', '3123', '8420' ]
Global Const $mess[50] = ['<strong><sub>Beautifull</sub></strong>', '<strong>Cool</strong> :D', '<strong><sub>Cool, cool, cool O.o :clap:</sub></strong>', '<strong><sub>Really nice done!</sub></strong>', 'Cool! This is so <strong>Great</strong> :D', '<sup>Beautifull, Cool!</sup>', '<sub>Rockin! :headbang: :XD:</sub>', 'This is nice :D :floating:', '<sub>Really nice done!</sub>', '<strong><sub>Beautifull, I do really like this piece! :giggle:</sub></strong>', '<strong><sub>Really nice done!</sub></strong>', 'Nice;) :#1:', '<sub>Very Original :w00t:</sub>', '<strong><sub>Cool :XD:</sub></strong>', 'Well Done! :wow:', '<sub> Nice :strong:</sub>', '<strong>This is just so nice!</strong>', '<strong>Amazing O.o</strong>', '<sub>Nice :D</sub>', 'This is cool! :w00t:', '<sub><strong>Well done, I am proud on you :XD:</strong></sub>', '<sub> I am Amazed :w00t: </sub>', '<strong>Cool!</strong>', '<sub> Nice :D </sub>',  '<sup><strong>Amazing :w00t:</strong></sup>',  '<sub>Beautifull</sub>', '<sub>:wtf: This is nice!</sub>', ':teddy:', ':O_o:', '<strong>Thanks for this!</strong> :hug:', ':omfg:', ':love:', 'Cool :aww:', '<sub>So Nice</sub>:heart:', 'Nice! :dance:', '<sub>Great</sub> :boogie:', ':noes: Nice! So Cool!', ':eager: Really Cool', '<strong>Nice!</strong> :iconcheesyplzy:', ':icongrinclub: :D', '<strong><sub>Wow, Nice!</sub></strong> :iconjarryplz:', '<strong>:iconlove: This!</strong>', '<sub>So nice! I only want to say: :icontextwallplz: :D</sub>', 'Getting happy of this :icontimmy64plz:', 'Woowie! :dance:', '<sub>Really Cool</sub>', '<sub><strong>Nice, Nice, Nice!</strong></sub>', 'This is Cool :D', ':noes:<sup>It looks great!</sup>', 'Great W0rk! :XD:' ]

; ============== SCRIPT ==============

Sleep ( 100 )
ToolTip ( "Currently:   Starting Script"&@CRLF&"Made by:    Rawox" , 10, 10, "Information:", 0, 4 )
ShellExecute ( "C:\Program Files\Mozilla Firefox\firefox.exe" )
WinWaitActive ( "Firefox" )
Sleep ( 1000 )
ToolTip ( "Currently:   Going To deviantART"&@CRLF&"Made by:    Rawox" , 10, 10, "Information:", 0, 4 )
Send ( "!d" )
Sleep ( 100 )
Send ( "deviantart ^{ENTER}" )
WinWaitActive ( "deviantART" )
Sleep ( 1500 )
ToolTip ( "Currently:   Clicking 'Newest' Tab"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
MouseClick ( "left", 1072, 256, 1, 1 )
Sleep ( 2000 )
Start ()

; ============== FUNCTIONS ==============

Func Start()
        ToolTip ( "Currently:   Sleeping"&@CRLF&"Made by:   Rawox" , 10, 10, "Information:", 0, 4 )
        $rand = Random ( 0, 50 )
        Sleep ( $randomsleep[Random(0,50)] )
        Sleep ( 500 )
        ToolTip ( "Currently:   Selecting Deviation"&@CRLF&"Made by:    Rawox" , 10, 10, "Information:", 0, 4 )
        PixelSearch ( 0, 0, 600, 600, $iColor1, 0 )
    If @error Then
        ReCheckStart()
        ToolTip ( "Currently:   Searching for 2nd Time"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Commenting"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        MouseClick ( 'left', $arr[0]+30, $arr[1]+30, 1, 5 )
        Sleep ( 500 )
        Send ( "{TAB}{ENTER}" )
        WinWaitActive ( "by" )
        Sleep ( 250 )
        Deviation()
    EndIf
EndFunc

Func Deviation()
        Sleep ( 1000 )
        Send ( "{END}{END}" )

        MouseClick('left', $arr[0], $arr[1], 1, 5)
    If @error Then
        Sleep ( 2250 )
        RecheckDeviation1()
        ToolTip ( "Currently:   Searching for 2nd Time"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Commenting"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        MouseClick ( "left", 550, 481, 1, 1 )
        Sleep ( 500 )
        $rand = Random ( 0, 50 )
        Send ( $mess[Random(0,50)], 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        Sleep ( 1000 )
        CheckTop()
    EndIf
EndFunc

Func CheckTop()
        ToolTip ( "Currently:   Checking For Top"&@CRLF&"Made by:   Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        ToolTip ( "Currently:   Checking 2nd Time For Top"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 1000 )
        RecheckTop()
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc

Func DeviationLogo()
        MouseClick ( "left", 93, 301, 1, 1 )
        Sleep ( 500 )
        End()
EndFunc

Func End()
        ToolTip ( "Currently:   Restarting Script"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        WinWaitActive ( "deviantART: where ART meets application" )
        Start()
EndFunc

; ============== RECHECKS ==============

Func ReCheckStart()
        Sleep ( 1000 )
        PixelSearch ( 0, 0, 600, 600, $iColor1, 0 )
    If @error Then
        ReCheckStart1()
        ToolTip ( "Currently:   Searching for 3th Time"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        MouseClick ( "left", 205, 390, 1, 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        WinWaitActive ( "by" )
        Sleep ( 250 )
        Deviation()
    EndIf
EndFunc

Func ReCheckStart1()
        Sleep ( 1000 )
        PixelSearch ( 0, 0, 600, 600, $iColor1, 0 )
    If @error Then
        MsgBox ( 0, "Error", "Something went wrong, we're still improving this script" )
        ToolTip ( "Currently:   Error!"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        MouseClick ( "left", 205, 390, 1, 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        WinWaitActive ( "by" )
        Sleep ( 250 )
        Deviation()
    EndIf
EndFunc

Func RecheckDeviation1()
        Sleep ( 1000 )
        Send ( "{END}{END}" )
        PixelSearch ( 200, 200, 800, 800, $iColor2, 0 )
    If @error Then
        RecheckDeviation2()
        ToolTip ( "Currently:   Searching for 3th Time"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Commenting"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        MouseClick ( 'left', $arr[0]+30, $arr[1]+30, 1, 5 )
        Sleep ( 500 )
        $rand = Random ( 0, 50 )
        Send ( $mess[Random(0,50)], 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        Sleep ( 1000 )
        CheckTop()
    EndIf
EndFunc

Func RecheckDeviation2()
        Sleep ( 1000 )
        Send ( "{END}{END}" )
        PixelSearch ( 200, 200, 800, 800, $iColor2, 0 )
    If @error Then
        MsgBox ( 0, "Error", "Something went wrong, we're still improving this script" )
        ToolTip ( "Currently:   Error!"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Commenting"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 500 )
        MouseClick ( 'left', $arr[0]+30, $arr[1]+30, 1, 5 )
        Sleep ( 500 )
        $rand = Random ( 0, 50 )
        Send ( $mess[Random(0,50)], 1 )
        Sleep ( 250 )
        Send ( "{TAB}{ENTER}" )
        Sleep ( 1000 )
        CheckTop()
    EndIf
EndFunc

Func RecheckTop()
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        ToolTip ( "Currently:   Checking 3th Time For Top"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 1000 )
        RecheckTop1()
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc

Func RecheckTop1()
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        ToolTip ( "Currently:   Checking 4th Time For Top"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 1000 )
        RecheckTop2()
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc

Func RecheckTop2()
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        Sleep ( 1000 )
        RecheckTop3()
        ToolTip ( "Currently:   Checking 5th Time For Top"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc

Func RecheckTop3()
        Sleep ( 1000 )
        PixelSearch ( 50, 50, 500, 500, $iColor3, 0 )
    If @error Then
        Sleep ( 1000 )
        MsgBox ( 0, "Error", "Something went wrong, we're still improving this script" )
        ToolTip ( "Currently:   Error!"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Else
        ToolTip ( "Currently:   Clicking Logo"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
        Sleep ( 100 )
        DeviationLogo ()
    EndIf
EndFunc


;======== EXIT FUNCTION ==============

Func ExitProg()
    ToolTip ( "Currently:   Exit in: 2 seconds"&@CRLF&"Made by: Rawox" , 10, 10, "Information:", 0, 4 )
    Sleep ( 2000 )
    ToolTip ( "Currently:   Exit in: 1 second"&@CRLF&"Made by:  Rawox" , 10, 10, "Information:", 0, 4 )
    Sleep ( 1000 )
    Exit
EndFunc

It's one of my first scripts and I'm still learning :)

When looking at the script you are only setting the $arr in the very startup at the DIM statement. Even if that failed, you do not check the @error then. Much later, after several other calls you are checking @error and assuming that if it is good, then the $arr is valid. That logic does not work. It could have failed at first, set @error, then later on another call resets @error and you test it. You need to verify @error right after a call, not later on.

Bob

--------------------bobchernow, Bob ChernowWhat a long strange trip it's beenUDFs: [post="635594"]Multiple Monitor Screen Resolution Change[/post]

Link to comment
Share on other sites

It's not so fun to read this long code especially not within a tag.

You have some unneeded functions or validation ways... For example, you don't need three functions that does the same, just loop like For $i = 0 To 2 or While $NofFound...WEnd.. and if the maximum tries your program allows has been reached you can notify it and shut your program.

About the real problem of your PixelSearch, I don't see any problem why you'll get a crash stating that you're referencing an array subscript with non-array variable if you're checking it correctly.... Good-luck.

Link to comment
Share on other sites

  • 2 weeks later...

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