Jump to content

How does pixelsearch work?


Bamse
 Share

Recommended Posts

Trying to answer the OP question i came up with a question myself..

the remarks in the pixelsearch func say:

The search direction varies as follows:
    Left-to-Right - left < right
    Right-to-Left - right < left
    Top-to-Bottom - top < bottom
    Bottom-to-Top - bottom < top
Changing the search direction can be a useful optimization if the color being searched for frequently appears in in a specific quadrat of the search area since less searching is done if the search starts in the most common quadrant.

My doubt is, how can i change the direction of the search? i don't see any parameter to define that, is it auto? I assume it is, and that should answer the OP.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

  • Developers

OK lets see you can figure this out by studying left-right as an example :)

Quote

 Left-to-Right - left < right
 Right-to-Left - right < left

So what exactly does this say ?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hi again,

This example actually shows everything for it.

As my example script I will show you what it does.

I will open this webpage in the browser and will leave my SCITE windows on the right of it.

On the webpage, I want it to move my cursor on the Facebook button. So what I will do first is start autoit window info and get the rectangle position.

In order to do so:

  1. Move the pointer to the top left of the button and check the X result - in my case 445 - this will be your left for the function
  2. The top will be the Y result - in my case 754
  3. Now move the pointer to the bottom right of the button and check the X result - in my case 527 - this will be your right for the function
  4. The bottom will be the Y result - in my case 787

To find the color, use the same program (autoit window info) and move the pointer to the color itself. I got result - 0x428BCA

And now the function:

;~ Search for color 0x428BCA between these coords:
$result = PixelSearch(445, 754, 527, 787, 0x428BCA)
;~ Move the mouse to the coords of the found color:
MouseMove($result[0], $result[1])

 

Link to comment
Share on other sites

@PunkoHead: I think the op knows how it works, seems he asked specifically the way it works

@Jos: Ah! you are of course correct, i overlooked the '<'

I just need to switch the values to search in the other direction.

So in order to search from left to right i need to set the left value as the smaller one, and the right as the bigger.

And in searching from right to left, the opposite, is that it?

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

The specific thing that i am having problems with is that i don’t really understand how it is searching for the pixels. I don’t get how left,top,bottom and right is working.
That's why i am asking one of you too draw a square and point out where left,top,bottom and right is I think that would help out!
 

Link to comment
Share on other sites

  • Developers
Just now, Bamse said:

That's why i am asking one of you too draw a square and point out where left,top,bottom and right is I think that would help out!  

Why draw something when it is described?
So did you actually look at the description in the helfile .... and .... also read this whole thread as it has more info in it now about your question?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers
Just now, Bamse said:

Yes i have been reading the help file.

there where 2 parts in that last question. ;) 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

So the helpfile description states:

Quote

The search direction varies as follows:
    Left-to-Right - left < right
    Right-to-Left - right < left
    Top-to-Bottom - top < bottom
    Bottom-to-Top - bottom < top

To translate the first line: It will scan from left-to-right when the Left parameter is smaller than the Right parameter. 
(I leave the rest for you to fill in)
Does that make it any clearer for you?

Jos
 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

10 minutes ago, Bamse said:

The specific thing that i am having problems with is that i don’t really understand how it is searching for the pixels. I don’t get how left,top,bottom and right is working.
 

In terms of coordinates, top left is zero. Meaning top = 0 left = 0 and bottom right is the max resolution, say you have a resolution of 800x600. right is 800 and bottom is 600.

So in a search from left to right , top to bottom, it starts from 0 to 800, onto de next line.. so all pixels in line 0 then all pixels in line 1 etc

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

  • Developers
1 minute ago, Bamse said:

I am getting an error

.. and you want us to guess what that error is?

My guess would be that you haven't looked at the example in the Helpfile!!!!

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

So what is there YOU DO NOT HAVE USED? (guess you want to have a shouting match?)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

My guess is

Subscript used on non-accessible variable.:
MouseMove($pix[0], $pix[1])
MouseMove($pix^ ERROR

Because the script didnt find the pixel. Add some tolerance.

$pix = PixelSearch(967, 0, 1919, 39, 0x44D723, 10)

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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