Problem with ScreenCapture

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Problem with ScreenCapture

Post by Aaron » Thu May 17, 2007 11:56 pm

Is ScreenCapture suppose to capture the desktop or the active window?

My script is below, after running the script I go and look at the image of screen and its a portion of my desktop, not the active window

Also my MessageModal will not stay on top,

Code: Select all

Let>MSG_STAYONTOP=1

Code: Select all

label>Compair
wait>1.5
ScreenCapture>117,100,360,255,C:\screen.bmp
CompareBitmaps>C:\screen.bmp,C:\accounts.bmp,match
If>match=95
Let>MSG_STAYONTOP=1
MessageModal>Screens Match
ELSE
Goto>Compair
Endif

Any thoughts would be appreciated
Aaron

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri May 18, 2007 12:09 am

It will capture whatever area of the screen you define. The coordinates will be based on the top left corner of the screen = 0,0. If you want to make the coordinates relative to a particular window then you'll need to first use GetWindowPos>window_title,X,Y to get the coordinates of that window and then calculate the x,y to pass to the ScreenCapture.

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Picture matches now but dose not display the MessageModal

Post by Aaron » Fri May 18, 2007 12:34 am

Picture matches now but dose not display the MessageModal
Aaron

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri May 18, 2007 1:34 am

You are looking for match=95 maybe it's not exactly 95? Maybe >95 would be better? Maybe MDL>%match% would be helpful to test?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri May 18, 2007 7:21 am

It is very unlikely to be exactly anything. Definitely use a greater than check, but test likely outcomes first.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Fri May 18, 2007 1:07 pm

This script will take a screenshot of the active window and saves it to your desktop as Active Window.bmp. In case anyone needs an example.

Code: Select all

wait>2
GetActiveWindow>NAME,X,Y,W,H
let>W=X+W
let>H=Y+H
ScreenCapture>X,Y,W,H,C:\Documents and Settings\%USER_NAME%\Desktop\Active Window.bmp
Enjoy,

Rain

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sat May 19, 2007 12:25 am

Thanks Rain. Due to the advanced technology of V9 I'm not always able to fire up MS on the laptop when playing on the forum :wink:

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

had to build an exe to work right

Post by Aaron » Fri May 25, 2007 5:19 pm

Picture matches now but dose not display the MessageModal
I had to build an exe for the messagemodual to work.

Thanks for the suggestion to use the > symbol, that worked fine.

I guess I was thinking it would automaticly check to see if it was greater than.

Thats what happens when theres a nut lose on the computer

Thanks everyone
Aaron

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts