ScreenCapture XY coordinates not working as expected?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

ScreenCapture XY coordinates not working as expected?

Post by Dorian (MJT support) » Sat Mar 27, 2004 5:01 am

Has anyone else noticed this? It seems altering the top left coordinates inteferes with the bottom right ones as though they are relative to each other?

Once the top/left are in perfect position and I go on to place the bottom right ones where they should be, any adjustment in the bottom/right seems to move the top/left, and vise versa.

Also there seems to be a lot of white space around the generated jpg or bmp. I tried at different screen resolutions (800x600 and 1024 x 768) and the results were the same. In my images the white space was always to the top and left of the target area.

I even wrote a macro loop which shows me the exact current coordinates of the mouse as I ove it around, in an attempt to get the right coordinates before I started, but these turn out to be completely different to what screencapture gives me when using those coordinates.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Fri Apr 09, 2004 4:56 pm

Any ideas on this one, oh wise MJT support gurus ?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Apr 09, 2004 6:58 pm

Are your questions regarding the use of Paint program?

Need more info.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Fri Apr 09, 2004 7:06 pm

hi Bob,

I'm not using Paint, it's justa regular screen dump using an astrology program I own. It seems most strange. I can post examples and screenshots here if it's allowed?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Apr 09, 2004 8:15 pm

How about providing the macro script code you are using to help explain what you are seeing?

Also you don't need a macro to show coordinates. Use the Macro Scheduler tools. Open the Editor, select Tools, Cursor Monitor. Use these values in your Macro Scheduler script. These are always absolute values for your screen, no relationship to any windows.

Can also get coordinates for a window by using GetWindowPos. Or if the window is the active one, the Width and Height are already there if you use GetActiveWindow> command. You can then add Width and Height variables to get lower right values for ScreenCapture.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Sat Apr 10, 2004 3:16 pm

Maybe I've missunderstood the topic at all:

I'm creating screenshoots with the press of ALT+Print (active window) to paste them afterwards into MSPaint. (My) MSPaint default image size is set to 1x1 pixel. If the screenshot won't fit to that default :wink: MSPaint requests if the image should be enlarged to fit tight.

I'm using Capture a tool from AnalogX

Marcus, would it make sense to get two optional params for MSched's ScreenCapture command, F(ull screen) and A(ctive window) as a Print, ALT+Print replacement ?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Sun Apr 11, 2004 4:41 am

Hi Guys,

Many thanks for the input. OK, here's what I am trying to do :

I have a program which makes astrological chartwheels, which I give away to me web visitors as a freebie. The program does not output these to a file, so a screendump is required. Then I *used to* open the dump in ulead photoimpact, and the macro would crop and save it. Now with the latest version of MS I can capture and crop all in one go, theoretically, without the need for photoimpact....


>>> the following just sets focus on the astro program, then does what is required to retrieve birth data from the file and create the wheel...
let>dir=1
label>start1
CapsOff
SetFocus>PCA
wait>0.05
Press Down
wait>0.05
Press CTRL
Send Character/Text>f
Release CTRL
Wait>0.05
setfocus>Birth*
wait>0.05
sen>0
wait>0.05
Press CTRL
Send Character/Text>c
Release CTRL
wait>0.05
getclipboard>nm
wait>0.05
if>%nm%=#############,end
SetFocus>PCA
wait>0.1
sen>r
wait>0.1
sen>v

>>>at this point the wheel has been drawn and is on the screen. below is the beginning of the capture and crop routine...

wait>0.2
>>> captures the image using a fixed name to get around the limitation of this commannd not liking spaces in the filename, checks to see if the real name already exists, and if it does saves it using the real name to the next directory.
ScreenCapture>150,61,800,606,d:\wheels01\123qaz.jpg
label>x
IfFileExists>d:\wheels0%dir%\%nm%.jpg,nextdir
movefile>d:\wheels01\123qaz.jpg,d:\wheels0%dir%\%nm%.jpg
wait>0.1
press del
goto>start1
label>nextdir
let>dir=dir+1
goto>x
label>end

It's hard to describe the way it's being odd, so I put this example up here :
http://www.2hosts.com/macro.htm

Lumumba

Post by Lumumba » Sun Apr 11, 2004 9:54 am

Once you've saved that screenshot with MSched's ScreenCapture> command you could follow this tutorial using ImageMagick to work on your : Graphics from the command line

Where to get ImageMagick :?: --> [here]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Apr 11, 2004 3:24 pm

Have you tried using %X1%,%Y1%,%X2%,%Y2% to replace the 150,61,800,606 values?
//Use GAW for child window, else let GAW_TYPE= default of 0.
Let>GAW_TYPE =1
GetActiveWindow>WindowName*,X1,Y1,Width,Height
Let>X2=%X1%+%Width%
Let>Y2=%Y1%+%Height%
ScreenCapture>%X1%,%Y1%,%X2%,%Y2%,d:\wheels01\123qaz.jpg
Hmm.....just looked at the link you provided. That was helpful. Since the coordinates will be absolute, I think before you use the Tool to capture the coordinates you should maximize the PCA ARGUS window. The Radix window looks maximized, but not the parent.

NEVER MIND! I've got it! This does appear to be a bug. Explanation follows:

I made a few screen captures and noticed that the white areas to the left and top are the same dimensions as the X,Y coordinates.
Example, if I do ScreenCapture>26,70,655,570,c:\temp\26_70.jpg then I get a white area that is 26 pixels wide to the left (X) and 70 pixels tall at the top (Y). ScreenCapture>126,170,655,570,c:\temp\126_170.jpg gives me an image with wider left side (126) and taller at top (170)

The "canvas" that is presented is the correct dimensions defined by ScreenCapture, and the image that is clipped is actually clipped at the correct X,Y start point, but the image is laid on the canvas at the X,Y coordinates of the canvas, not at the 0,0 coordinates.

Cannot think of a work around.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Sun Apr 11, 2004 7:16 pm

Thanks Bob,

It's good to know I wasn't doing something wrong. I was tearing my hair out trying to resolve this one. Hopefully Marcus will cure the bug in the next update.

In the meantime I will investigate ImageMagick - thanks Lumumba. :D

Incidentally, I've been using MS for years, and never even noticed there was a tools menu! :oops: So thanks ever-so for pointing that out!

Guest

Post by Guest » Mon Apr 12, 2004 5:35 pm

Another screen capture program that takes command lines and works well with macro scheduler is version 4 of hypersnap from http://www.hyperionics.com

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1415
Joined: Sun Nov 03, 2002 3:19 am

Post by Dorian (MJT support) » Mon Apr 12, 2004 10:30 pm

Anonymous wrote:Another screen capture program that takes command lines and works well with macro scheduler is version 4 of hypersnap from http://www.hyperionics.com
That's very interesting, thank you. I've been looking for something like hypercam too, so I know that publisher will be very useful to me.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat May 29, 2004 9:40 pm

Also see reply made today on related subject at:
http://www.mjtnet.com/forum/viewtopic.php?p=4081#4081
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

nico

Post by nico » Wed Dec 15, 2004 5:20 am

ive also run into the infamous screen capture program and its been pissing me of for ever. I really love your program, and really hate this bug... i have to words for you guys.. respectively: UNIT TEST>

thanks.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed Dec 15, 2004 8:15 am

Hi,

Well isn't that's nice. It's comments like this that make it all worth while!

Be warned. That kind of language and attitude will get you kicked off this forum.

As far as the bug is concerned I am sorry that it was overlooked. This is why we have introduced the BugTracker (http://www.mjtnet.com/bugtracker/) so that we don't miss bug reports in future. I have now added this bug to BugTracker and confirmed it.
MJT Net Support
[email protected]

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