Sign in to follow this  
Followers 0
lilandywandy

Need help on making a working script

15 posts in this topic

Lets say i know the color , and its 000000

how can i make the mouse click at the 000000s , one at a time and sleep

ie,) clicks on a black spot, sleeps for 1 min, then clicks on another black spot and sleeps 1 min

Share this post


Link to post
Share on other sites



On all of them? (There are likely to be many black pixels on your screen)

Share this post


Link to post
Share on other sites

no i just made up black, its more of a maroon color which im gonna use a dye and find correct color... anyways any idea on how to do this? and i also wanted to say,...if the script can --->"if theres no color-x, then do nothing until there is" and also for it to click 1 at a time

Share this post


Link to post
Share on other sites

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I posted a 'find all pixels' function somewhere on another thread recently, you can search for that.

; This should do what you want, basically
While 1 
    $Find = _PixelFindAll(parameters here)
    
    For $i = 1 to $Find[0][0]
       ;stuff here for each pixel
    Next

    Sleep(60*1000)
WEnd

May have to add an If for sanity sake.

Edited by Insolence

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

I posted a 'find all pixels' function somewhere on another thread recently, you can search for that.

; This should do what you want, basically
While 1 
    $Find = _PixelFindAll(parameters here)
    
    For $i = 1 to $Find[0][0]
      ;stuff here for each pixel
    Next

    Sleep(60*1000)
WEnd

May have to add an If for sanity sake.

<{POST_SNAPBACK}>

wat am i supposed to put in parameter?

Share this post


Link to post
Share on other sites

have u at least tryed making ur own script? if so could we see it and then we could help you


FootbaG

Share this post


Link to post
Share on other sites

lilandywandy, Use that link and read the first post. Read all of it. Cpy the code into your script. Then use this:
; This should do what you want, basically
While 1 
    $Find = _PixelFindAll(parameters here)
    
    For $i = 1 to $Find[0][0]
     ;stuff here for each pixel
    Next

    Sleep(60*1000)
WEnd

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Share this post


Link to post
Share on other sites

Aye, you'll have to LOOK at my function to put the right parameters in -.-

If you haven't used PixelSearch yet you're looking a bit too far ahead I'm afraid.


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

; This should do what you want, basically

While 1

$Find = _PixelFindAll(Func _PixelFindAll($i_PosLeft, $i_PosTop, $i_Width, $i_Height, $i_Color, $i_Shade = 0, $i_Step = 1)

If $i_PosLeft <> Abs(Int($i_PosLeft)) Or $i_PosTop <> Abs(Int($i_PosTop)) Or $i_Width <> Abs(Int($i_Width)) Or $i_Height <> Abs(Int($i_Height)) Or $i_Color <> Abs(Int($i_Color)) Or $i_Shade < 0 Or $i_Shade <> Abs(Int($i_Shade)) Or $i_Step = 0 Or $i_Step <> Abs(Int($i_Step)) Or $i_Color > 0xFFFFFF Or $i_PosLeft + $i_Width > @DesktopWidth Or $i_PosTop + $i_Height > @DesktopHeight Then

Local $ai_Return[1][1]

$ai_Return[0][0] = 0

SetError(1)

Return $ai_Return

EndIf

Local $ai_Return[$i_Width * $i_Height + 1][2]

Local $ai_Original[3]

Local $i_Count

Local $i_Count_X

Local $i_Count_Y

Local $i_Found

$ai_Return[0][0] = 0

$ai_Return[0][1] = $i_Color

$ai_Original[0] = BitAND(BitShift($i_Color, 16), 0xff)

$ai_Original[1] = BitAND(BitShift($i_Color, 8), 0xff)

$ai_Original[2] = BitAND($i_Color, 0xff)

If $i_Width / $i_Step <> Int($i_Width / $i_Step) Then

Do

$i_Width = $i_Width - 1

Until $i_Width / $i_Step = Int($i_Width / $i_Step) Or $i_Width = 0

EndIf

If $i_Height / $i_Step <> Int($i_Height / $i_Step) Then

Do

$i_Height = $i_Height - 1

Until $i_Height / $i_Step = Int($i_Height / $i_Step) Or $i_Height = 0

EndIf

If $i_Width = 0 And $i_Height = 0 Then

Local $ai_Return[1][1]

$ai_Return[0][0] = 0

SetError(1)

Return $ai_Return

EndIf

For $i_Count_X = $i_PosLeft To $i_PosLeft + $i_Width - 1 Step $i_Step

For $i_Count_Y = $i_PosTop To $i_PosTop + $i_Height - 1 Step $i_Step

$i_Found = PixelGetColor($i_Count_X, $i_Count_Y)

If Abs(BitAND(BitShift($i_Found, 16), 0xff) - $ai_Original[0]) + Abs(BitAND(BitShift($i_Found, 8), 0xff) - $ai_Original[1]) + Abs(BitAND($i_Found, 0xff) - $ai_Original[2]) <= $i_Shade Then

$i_Count = $ai_Return[0][0] + 1

$ai_Return[0][0] = $i_Count

$ai_Return[$i_Count][0] = $i_Count_X

$ai_Return[$i_Count][1] = $i_Count_Y

EndIf

Next

Next

$i_Count = $ai_Return[0][0]

ReDim $ai_Return[$i_Count + 1][2]

Return $ai_Return

EndFunc ;==>_PixelFindAll)

For $i = 1 to $Find[0][0]

;stuff here for each pixel

Next

Sleep(60*1000)

WEnd

can someone bold me the parts im supposed to modify... im not sure what to do

Share this post


Link to post
Share on other sites

lol

That's VERY complicated code, I can't read it, and it looks like you didn't read it either.

Why don't you start on something smaller? Or atleast put

tags around your code so it's readable.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

yes, please use the tags and indent it so we can read it easily


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites

i just did wat wovleness told me to do =s

Share this post


Link to post
Share on other sites

Your code has syntax problems... cannot have an EndFunc inside a While...Wend loop.

See below result when ran through Tidy:

; This should do what you want, basically
While 1
    $Find = _PixelFindAll (Func _PixelFindAll ($i_PosLeft, $i_PosTop, $i_Width, $i_Height, $i_Color, $i_Shade = 0, $i_Step = 1)
    If $i_PosLeft <> Abs(Int($i_PosLeft)) Or $i_PosTop <> Abs(Int($i_PosTop)) Or $i_Width <> Abs(Int($i_Width)) Or $i_Height <> Abs(Int($i_Height)) Or $i_Color <> Abs(Int($i_Color)) Or $i_Shade < 0 Or $i_Shade <> Abs(Int($i_Shade)) Or $i_Step = 0 Or $i_Step <> Abs(Int($i_Step)) Or $i_Color > 0xFFFFFF Or $i_PosLeft + $i_Width > @DesktopWidth Or $i_PosTop + $i_Height > @DesktopHeight Then
        Local $ai_Return[1][1]
        $ai_Return[0][0] = 0
        SetError(1)
        Return $ai_Return
    EndIf
    Local $ai_Return[$i_Width * $i_Height + 1][2]
    Local $ai_Original[3]
    Local $i_Count
    Local $i_Count_X
    Local $i_Count_Y
    Local $i_Found
    $ai_Return[0][0] = 0
    $ai_Return[0][1] = $i_Color
    $ai_Original[0] = BitAND(BitShift($i_Color, 16), 0xff)
    $ai_Original[1] = BitAND(BitShift($i_Color, 8), 0xff)
    $ai_Original[2] = BitAND($i_Color, 0xff)
    If $i_Width / $i_Step <> Int($i_Width / $i_Step) Then
        Do
            $i_Width = $i_Width - 1
        Until $i_Width / $i_Step = Int($i_Width / $i_Step) Or $i_Width = 0
    EndIf
    If $i_Height / $i_Step <> Int($i_Height / $i_Step) Then
        Do
            $i_Height = $i_Height - 1
        Until $i_Height / $i_Step = Int($i_Height / $i_Step) Or $i_Height = 0
    EndIf
    If $i_Width = 0 And $i_Height = 0 Then
        Local $ai_Return[1][1]
        $ai_Return[0][0] = 0
        SetError(1)
        Return $ai_Return
    EndIf
    For $i_Count_X = $i_PosLeft To $i_PosLeft + $i_Width - 1 Step $i_Step
        For $i_Count_Y = $i_PosTop To $i_PosTop + $i_Height - 1 Step $i_Step
            $i_Found = PixelGetColor($i_Count_X, $i_Count_Y)
            If Abs(BitAND(BitShift($i_Found, 16), 0xff) - $ai_Original[0]) + Abs(BitAND(BitShift($i_Found, 8), 0xff) - $ai_Original[1]) + Abs(BitAND($i_Found, 0xff) - $ai_Original[2]) <= $i_Shade Then
                $i_Count = $ai_Return[0][0] + 1
                $ai_Return[0][0] = $i_Count
                $ai_Return[$i_Count][0] = $i_Count_X
                $ai_Return[$i_Count][1] = $i_Count_Y
            EndIf
        Next
    Next
    $i_Count = $ai_Return[0][0]
    ReDim $ai_Return[$i_Count + 1][2]
    Return $ai_Return
;### Tidy Error: Level error -> EndFunc is closing previous While
EndFunc  ;==>

For $i = 1 To $Find[0][0]
;stuff here for each pixel
Next

Sleep(60 * 1000)
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
WEnd

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

anyone know a solution?

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