Jump to content
Macro Express Forums

Pixel checking surprisingly slow


Recommended Posts

I've been using script looking roughly like this:

 

Repeat Until %PixelCol% Equals "1477631"

Get Pixel Color at (%X%, %Y%) Relative to Screen into %PixelCol%

Variable Modify Integer %X%: Increment

End Repeat

//Location identified

etc

 

But it seems very slow. I could get into a specific example, but thought I'd first ask here if others have noted similar behaviour? Is there perhaps a marked difference when using the Get Pixel Color at command (and changing the position), compared to using Get Pixel Color Beneath the Mouse (and moving the mouse cursor)?

 

BTW, IMO the latter does have the advantage while testing that you can more easily see what the macro is doing, because of the moving mouse cursor.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Just for fun, I wrote a macro to write all the pixels on my 1280x1024 screen to a file. I then rewrote the macro in AutoIt.

 

MEP takes 3.5 minutes to run, while AutoIt takes 2.25 minutes; so AutoIt is not that much quicker in this case.

Link to comment
Share on other sites

Thanks both.

 

I wrote a test macro for locating a pixel in Notepad. That ran fast. So I think that the slightly more complex and very slow macro that led to my question, which runs in my video editing program (Movie Edit Pro 16 Plus) must be flawed in some other way. I'll take a harder look at it.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Yeah, the Aero theme can create problems for Get Pixel Color and similar commands. This is a known problem caused by 3D rendering. You'll face similar difficulties with many games and Flash programs.

 

Apparently, when there is rendering, the pixel color will change slightly every few seconds. You won't notice the change, but it is enough to break most scripts.

 

I suggest you create a "pixel dump" test script which will just sample one particular pixel repeatedly, say 10 times in one second. Then report all 10 values in a dialog box. If you see a few different numbers, you could adjust your script to check for those too.

 

Mine works surprisingly quick so it isn't inherent. I seem to remember someone once saying that the Aero themes in Vista and 7, could that be it?

Link to comment
Share on other sites

Since you've already tried AutoIt, might I suggest AutoHotkey? It's got lightning-fast built-in commands called ImageSearch and PixelSearch, which do exactly what their names suggest.

 

They're so fast that I can even use them for scripting games.

 

Just for fun, I wrote a macro to write all the pixels on my 1280x1024 screen to a file. I then rewrote the macro in AutoIt.

 

MEP takes 3.5 minutes to run, while AutoIt takes 2.25 minutes; so AutoIt is not that much quicker in this case.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...