Jump to content
Macro Express Forums

is there a way to capture an area of desktop and compare it?


wsam7
 Share

Recommended Posts

i want to create a auto login for a vnc connection

as far as i know the time for the login screen come up is random

and because of that

i need a simple screen change detection

 

let say i want to capture whatever is in the middle of the screen

store it some where

compare it after 10 second

if the image is different,

type in login id and pw

 

thats it.

 

is there a way to do it?

Link to comment
Share on other sites

I would use Print Screen, save the images as jpgs, then compare the sizes of them. Something like this...

 

Repeat Start (Repeat 2 times)

Variable Modify Integer: %N1% = %N1% + 1

Text Type: <ALTD><PRTSCR><ALTU>

Delay 500 Milliseconds

Clipboard Save Graphic: "%N1%.jpg"

Delay 3 Seconds

Repeat End

Variable Set Integer %N2% from the size of file "1.jpg"

Variable Set Integer %N3% from the size of file "2.jpg"

If Variable %N2% = variable %N3%

Text Box Display: Image is same

Else

Text Box Display: Image has changed

End If

Link to comment
Share on other sites

That sounds very neat- It brings to mind a potential solution for a similar problem (On topic, too, I believe!) I'm working on.

 

I work with a program that fills out rows of data, but ME can't get control or select the contents of the individual fields in the rows.

 

Is there a way to do a custom screen capture so it only takes an X-Y/X-Y sample of the screen (the field in question) and then compare what the size of a blank field would be to a populated field? I know you can do this in OS-X (command-shift-4, then click and drag) but how about WinXP? Looking in the XP help just shows a full screen or window capture.

Link to comment
Share on other sites

I don't know of any way to do this in Windows but you could capture the screen with the PrintScreen, copy it to the clipboard, Clipboard Save Graphic to a file then use IrfanView with a crop command line parameter to create such a file then compare. But this is work.

 

Have you tried using the Get Pixel Color? I’ve done screen area evaluations before this way by plowing thru an area of pixels on the screen to see if a pattern matches. Use nested repeats incrementing integers that will change which pixel to evaluate and compare the resultant list to a presaved file. It works and it’s not as complex as it sounds. Also if you’re looking to see if a field is blank you can simply plow thru it looking to see if any pixels do not equal white.

 

Also if you’re looking to evaluate a field that doesn’t vary too much, EG either it’s all white or it has the Word “OK” in it, you can find one pixel where the black of the text appear and test that. But this requires that it always be nearly the same.

 

There is another piece of software like ME out there I came across the other day that does something called HayStacking. http://www.mjtnet.com/demos/irdemo.html This looks for patterns in blocks of graphics just as you described. I have not checked it out yet but it looks promising, you might want to check it out.

Link to comment
Share on other sites

Cory-

 

"plowing through the pixels" was actually my second choice for tackling this. I have a macro very similar to that which uses a repeat loop, with an incremental Var Mod String to adjust the pixel detection coordinates to determine which row in a list is highlighted (at which point the XY coords are stored) in order to remember which row was previously opened.

 

I guess I will be modifying that with an additional repeat loop within it to search a diagonal path across a character space to look for black.

 

I guess my question was more of a "Windows" question than an "ME" question, but thanks for answering it all the same!

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

×
×
  • Create New...