Discussion:
Simulating "Print Screen" using SendKeys or similar
(too old to reply)
RA Finch
2006-04-24 18:34:01 UTC
Permalink
I need to copy the screen to the clipboard but haven't had any luck.

According to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformssendkeysclasstopic.asp
I should be able to use SendKeys "{PRTSC}", but it doesn't seem to work.
"{SCROLLLOCK}" and "{NUMLOCK}" function correctly.

Dim WshShell
set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 100
WshShell.SendKeys "{PRTSC}"

Thanks.
v***@gmail.com
2006-04-24 23:03:55 UTC
Permalink
Make sure the NumLock key isn't on. We had that problem and worked on
it for several days before discovering it. It messes up things.

Dave
RA Finch
2006-04-25 17:00:01 UTC
Permalink
Thanks for the suggestion Dave, but I tried running the script w/ NumLock
off, and it still wouldn't work.

Were you able to get SendKeys "{PRTSC}" to function properly?
Post by v***@gmail.com
Make sure the NumLock key isn't on. We had that problem and worked on
it for several days before discovering it. It messes up things.
Dave
Michael Harris (MVP)
2006-04-26 01:45:47 UTC
Permalink
Post by RA Finch
Thanks for the suggestion Dave, but I tried running the script w/
NumLock off, and it still wouldn't work.
Were you able to get SendKeys "{PRTSC}" to function properly?
Post by v***@gmail.com
Make sure the NumLock key isn't on. We had that problem and worked
on it for several days before discovering it. It messes up things.
Dave
Best to consult the documentation for SendKeys...

"...
You cannot send the PRINT SCREEN key {PRTSC} to an application.
..."

Download details: Windows Script 5.6 Documentation
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
--
Michael Harris
Microsoft MVP Scripting
RA Finch
2006-04-26 18:39:03 UTC
Permalink
Thanks Michael. The documentation wasn't available for some reason when I
tried a min. ago, but I did read that in a few places.

So, is there any other way to copy a screen capture to the clipboard using
VBS?
Post by Michael Harris (MVP)
Best to consult the documentation for SendKeys...
"...
You cannot send the PRINT SCREEN key {PRTSC} to an application.
...."
Download details: Windows Script 5.6 Documentation
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en
--
Michael Harris
Microsoft MVP Scripting
Michael Harris (MVP)
2006-04-27 03:17:53 UTC
Permalink
Post by RA Finch
Thanks Michael. The documentation wasn't available for some reason
when I tried a min. ago, but I did read that in a few places.
I reported the problem with the doc link...
Post by RA Finch
So, is there any other way to copy a screen capture to the clipboard
using VBS?
Not that I know of - perhaps with a 3rd party product...
--
Michael Harris
Microsoft MVP Scripting
mayayana
2006-04-27 03:37:19 UTC
Permalink
If you want to use a component see here:

http://www.jsware.net/jsware/scripts.php3#draw

It's a component designed for VBS that provides
a screen capture function with parameters to define
the area captured.
There are also onscreen "painting" functions and
a system window that can be drawn on, or have a picture
mounted on, for use as a custom message box.
Post by RA Finch
Thanks Michael. The documentation wasn't available for some reason when I
tried a min. ago, but I did read that in a few places.
So, is there any other way to copy a screen capture to the clipboard using
VBS?
Post by Michael Harris (MVP)
Best to consult the documentation for SendKeys...
"...
You cannot send the PRINT SCREEN key {PRTSC} to an application.
...."
Download details: Windows Script 5.6 Documentation
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-
8A76-1C4099D7BBB9&displaylang=en
Post by RA Finch
Post by Michael Harris (MVP)
--
Michael Harris
Microsoft MVP Scripting
Loading...