Sign in to follow this  
Followers 0
zfoxhunterz

I want to Loop my hole script

6 posts in this topic

this script is called myscript.au3 . and my code is not working please help me here.

$pixelcolor1=pixelgetcolor(50,36)
$pixelcolor2=pixelgetcolor(52,36)
$pixelcolor3=pixelgetcolor(54,36)
$pixelcolor4=pixelgetcolor(56,36)
$pixelcolor5=pixelgetcolor(58,36)
$pixelcolor6=pixelgetcolor(60,36)
$pixelcolor7=pixelgetcolor(62,36)
$pixelcolor8=pixelgetcolor(64,36)
$pixelcolor9=pixelgetcolor(66,36)
$pixelcolor10=pixelgetcolor(68,36)
$pixelcolor11=pixelgetcolor(70,36)

If $pixelcolor1 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor2 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor3 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor4 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor5 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor6 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor7 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor8 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor9 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor10 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor11 = 6510897 Then
    Send("{PAUSE}")
Else
    Run("C:\Documents and Settings\my comp\Desktop\folder\myscript.au3")
EndIf

Please tell me what im doing wrong and how i can make this work thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Not Tested **********

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused, $Runner
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "Run_myScript")

;;;; Body of program would go here ;;;;
While 1
    
    If $Runner Then
        ToolTip('Script is "Running"', 0, 0)
        For $x = 50 To 70 Step 2
            If PixelGetColor($x, 36) = 6510897 Then
                Send("{PAUSE}")
                ; $runner = 0 ; ?????????
                ExitLoop
            EndIf
        Next
    EndIf
    ToolTip("")
    Sleep(500)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func Run_myScript()
    ; to stop AND Start your script
    $Runner = Not $Runner
EndFunc   ;==>Run_myScript

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

this script is called myscript.au3 . and my code is not working please help me here.

$pixelcolor1=pixelgetcolor(50,36)
$pixelcolor2=pixelgetcolor(52,36)
$pixelcolor3=pixelgetcolor(54,36)
$pixelcolor4=pixelgetcolor(56,36)
$pixelcolor5=pixelgetcolor(58,36)
$pixelcolor6=pixelgetcolor(60,36)
$pixelcolor7=pixelgetcolor(62,36)
$pixelcolor8=pixelgetcolor(64,36)
$pixelcolor9=pixelgetcolor(66,36)
$pixelcolor10=pixelgetcolor(68,36)
$pixelcolor11=pixelgetcolor(70,36)

If $pixelcolor1 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor2 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor3 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor4 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor5 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor6 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor7 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor8 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor9 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor10 = 6510897 Then
    Send("{PAUSE}")
ElseIf $pixelcolor11 = 6510897 Then
    Send("{PAUSE}")
Else
    Run("C:\Documents and Settings\my comp\Desktop\folder\myscript.au3")
EndIf

Please tell me what im doing wrong and how i can make this work thanks

For openers you can't run() a scrpt that way

Use

Shell execute("C:\Documents and Settings\my comp\Desktop\folder\myscript.au3","","","Run") instead

Secondly what par of the script do you want loop?

If Its only The If/ElseIf portion then

Use While i

If

ElseIf

Etc

Etc

Else

Shell execute("C:\Documents and Settings\my comp\Desktop\folder\myscript.au3","","","Run")

ExitLoop

WEnd


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I want it to run the script over and over and over again untill one of thoes 10 pixels become the color i want them to be. and if that happens i want it to stop running the script and then press the pause button.

Edited by zfoxhunterz

Share this post


Link to post
Share on other sites

btw are you wanting to send the word "Pause" or click a button thats Named "Pause"

i want to click the button thats named paues

thanks man i cant wait to try this out. and i cant wait to start learning more autoit.

Share this post


Link to post
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
Sign in to follow this  
Followers 0