ScreenShot results in totally Black Image [RESOLVED]

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

ScreenShot results in totally Black Image [RESOLVED]

Post by Phil Pendlebury » Thu Mar 22, 2007 8:34 pm

Hi there,

One of my users is experiencing this problem.

There is a section of my code that uses the screenshot feature etc. It works great but this one person could never get a result from it.

We have now realised that the reason for this is that the screen image taken is always completely black.

I have made another small app for him that does nothing except display a message and then take a screen shot so that he can try it with different apps other than the one that my main MS is written for.

Has anyone come across this before?

Is this possibly something on his system or an MS anomaly of some kind?

Any suggestions appreciated.

Thanks.

:)
Last edited by Phil Pendlebury on Sat Mar 24, 2007 8:05 am, edited 1 time in total.
Phil Pendlebury - Linktree

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Fri Mar 23, 2007 1:21 am

If "printscreen" is used (Press Print Screen), and then an "edit-paste" performed in an image application (such as mspaint, etc), is it also black there?

I'm wondering if this is something specific to just msched, or just a screenshot-type thing in general.

User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Fri Mar 23, 2007 2:01 am

Captive wrote:If "printscreen" is used (Press Print Screen), and then an "edit-paste" performed in an image application (such as mspaint, etc), is it also black there?

I'm wondering if this is something specific to just msched, or just a screenshot-type thing in general.
Me too...

The guy said that printscreen shows a proper image. That's why I have made him a macro that uses only the screenshot feature. It allows 10 seconds for him to set focus on any window and then takes a shot using MS screen cap feature.

I am waiting to hear if selecting other windows (than the one the app is written for) also show only black or not.
Phil Pendlebury - Linktree

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Fri Mar 23, 2007 3:37 am

Edit: After I wrote this, I realized that you had already wrote something that suggests "the script works" but just not on this 1 persons PC. The last thing might still apply though if he has a multi-monitor setup and the screenshot is of "display2" or something.

After the ScreenCapture command, have you examined the value of %SCREENCAP_RESULT% ? (It should = 0)

I had recently written a screenshot related macro. In Macro Scheduler v8, I had a few minor issues that have been fixed in v9;
- I could not specify a %variable% as the filename in the "ScreenCapture" command.
- I don't think GetScreenRes existed until v9, so I used a trick that would 1) Remember where the mouse is. 2) Try to move the mouse to X=4000, y=4000 3) Use the current mouse position as the x and y for the screencapture, 4) put the mouse back to the original position.

Perhaps try with a few "keep it simple" tests. See if a basic macro can capture the screen (or a portion of the screen).

Let>sFilename=C:\ScreenShotTest.JPG
GetScreenRes>nScreenX,nScreenY
ScreenCapture>1,1,%nScreenX%,%nScreenY%,%sFilename%

If that fails. Perhaps try a bmp, and specifying a portion of the screen and including the filename in the command;
ScreenCapture>1,1,400,400,C:\ScreenShotPartial.bmp

Another thought, is perhaps there is something wrong with your X1,Y1,X2,Y2 values, so you're declaring a rectangle that's outside the visible display? (I don't even know what that would do).

User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Fri Mar 23, 2007 3:48 am

In my main macro the line is very simple.

Code: Select all

 GetScreenRes>mx,my
  ScreenCapture>0,0,mx,my,%SCRIPT_DIR%\graphics\export.bmp
And this is working perfectly for everyone except this one guy.

He uses two monitors
But so do I
And he has tried with only 1 monitor

I have written a very simple tool fro him to test with:

Code: Select all

MessageModal>Taking SS after 10 seconds
Wait>10
 GetScreenRes>mx,my
 ScreenCapture>0,0,mx,my,%SCRIPT_DIR%\test.bmp
MessageModal>OK
This will give him 10 seconds to choose what the SS will be of and then hopefully we will see what goes on.

Standing by.

Thanks for the replies btw.

:-)
Phil Pendlebury - Linktree

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Fri Mar 23, 2007 7:57 am

Ooo, I've been using x1 and y1 values of 1. Maybe I need to change my script!

If you get nowhere with your current test - check out what that %SCREENCAP_RESULT% says and even test with something simple as
ScreenCapture>10,10,200,200,c:\mypic.bmp

Could it even be a vista thing (ie, he's the only person using it?)

And yw for the replies! (It may be something here you end up teaching us.) I'm interested in your findings.

User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Fri Mar 23, 2007 11:51 am

No it's not a Vista issue. I am using Vista and it works perfectly. He is using XP.
Phil Pendlebury - Linktree

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 Mar 23, 2007 12:55 pm

The first thing I would do would be to check that the correct and most up to date display drivers are installed. Next, does this only happen on one particular window, or any window? Does it matter what is on the screen - will it always return a black bitmap whatever the screenshot is of? Or is it application specific?
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
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Post by Phil Pendlebury » Sat Mar 24, 2007 8:08 am

Hi all,

Just to let you know that this has been solved:

My app has feature that presses F2 before taking the screen-shot. I just received this from the guy who was having trouble:
F2 !!!!!!

I have a blank screen saver which.... is assigned to F2.

LOL - what's happening is your app is invoking my windows blankscreen saver and then taking a piccie ( which accounts for the blackness ) .
You can delete this thread if you wish. Sorry for wasting your time.
Phil Pendlebury - Linktree

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

Post by Marcus Tettmar » Sat Mar 24, 2007 8:26 am

:lol:
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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