Jump to content

Pixel Search Looping


Recommended Posts

Me again, I want to loop the arrow keys moving whatever directions I want em' until It find the pixel I'm looking for.

I have a code like:

Local $coord
While 1
$coord = PixelSearch( 0, 0, 1700, 1100, COLOR)
If Not @error Then ExitLoop
If @error Then Send("{DOWN}")
sleep (10)
Send("{RIGHT 1}")
sleep (10)
Send("{UP}")
sleep (10)
Send("{LEFT 1}")
sleep (10)
WEnd
MsgBox(64,"Information","Pixel Found at ("&$coord[0]&','&$coord[1]&')')

But it only searches the pixel when it is on the last command, which is the LEFT button. What is wrong?

Why is that? I'm using this to erase certain pixel on REALWORLD icon Editor. My computer is slow for any editing software. And it's a real pain using magic wand. Any way, hope you guys can tell me what's wrong.

Edited by Brightview
Link to comment
Share on other sites

well first off, it doesnt make sense to have 2 if statments if they do the same thing.

secondly, it does do a pixel search or else it wouldnt do the arrow keys

here is the code that makes the most sense:

Local $coord
While 1
$coord = PixelSearch( 0, 0, 1700, 1100, COLOR)
If Not @error Then ExitLoop
Sleep(100)
Send("{DOWN}")
sleep (10)
Send("{RIGHT 1}")
sleep (10)
Send("{UP}")
sleep (10)
Send("{LEFT 1}")
sleep (10)
WEnd
MsgBox(64,"Information","Pixel Found at ("&$coord[0]&','&$coord[1]&')')

other than that, its unclear what u r trying to do and what autoit is or isnt doing for you. elaborate more maybe??

Link to comment
Share on other sites

Basically, what I want is, the arrow keys will be pressed until it it find the pixel. But the thing is, It only works when the left key is being pressed.

For example:

down, right, up (desired pixel) <-- (not tracked) left, down, right, up, left (desired pixel) <-- it only works if the left key founds the desired pixel

Link to comment
Share on other sites

There is nothing in your script to indicate it dose anything when a key is pressed.

And furthermore if it finds the pixel the cursor (or whatever the {down} right etc..

are controlling move in some sort of circle, ending up back where it started.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Basically, what I want is, the arrow keys will be pressed until it it find the pixel. But the thing is, It only works when the left key is being pressed.

For example:

down, right, up (desired pixel) <-- (not tracked) left, down, right, up, left (desired pixel) <-- it only works if the left key founds the desired pixel

this is because you have told autoit to:

look for a pixel

if you dont find it, continue

press some buttons

start the loop over

if you want it to look for a pixel after every arrow you press, you need to tell it to.

what it looks like you want it to do is to do a pixel search and the if statment after every send. which a few copy and pastes will fix

Link to comment
Share on other sites

Read the title, got a feeling this isn't 100% legit ...

[font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler]

Link to comment
Share on other sites

Read the title, got a feeling this isn't 100% legit ...

The title does not indicate anything other that a pixelsearch in a loop, which is entirely

within the bounds of the forum rules.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Instead of doing waits between presses, you can update the time between presses, and the press time for each key through the AutoItSetOption function. Sometimes a game/application will not respond to the default 10ms press time ;)

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

http://i48.tinypic.com/2ninrkx.png

As you can see on the link I want to remove those whites. But whenever I tried to Color pick-Flood Fill, only 1 pixel is being removed at a time(Learned that there are different shades per pixel actually). Or I should remove the arrow keys? If I can implement the moving of arrow key, maybe I can supply an erase button after it finds a pixel, but I need to loop it. Oh, and setting sleep (10) works for me, it's just a transparency editing program.

Edited by Brightview
Link to comment
Share on other sites

There is nothing in your script to indicate it dose anything when a key is pressed.

And furthermore if it finds the pixel the cursor (or whatever the {down} right etc..

are controlling move in some sort of circle, ending up back where it started.

No, it's like mapping the screen.
If Not @error Then Send("{DEL}")

this seems to do the trick But I want the script to loop.

this is because you have told autoit to:

look for a pixel

if you dont find it, continue

press some buttons

start the loop over

if you want it to look for a pixel after every arrow you press, you need to tell it to.

what it looks like you want it to do is to do a pixel search and the if statment after every send. which a few copy and pastes will fix

Ah. That'll solve the problem, but how do you loop it? Edited by Brightview
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...