Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Screen Capture and Save

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,3490
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Screen Capture and Save
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Screen Capture and Save - 6/22/2005 8:08:11 AM   
  automateddude

 

Posts: 4
Score: 0
Joined: 6/22/2005
From: USA
Status: offline
I need help trying to save a screen capture. I am using an application that can start outside applications. I tried using a script found in another topic on this forum, but it didn't work for me. It involved using the SendKeys method to try to send a {PRTSC}. The Paint application started up fine, but the picture it saved was blank. In addition, I want to be able to pass the name of the file to save the picture under to the script from the initiating application. Any help would be appreciated.

Thanks.
 
 
Post #: 1
 
 Re: Screen Capture and Save - 6/22/2005 11:43:59 AM   
  marcusrp

 

Posts: 145
Score: 0
Joined: 4/19/2005
From:
Status: offline
if you do a printscreen, usually you have to paste it or copy it into some other application, such as paint or MS word. you might try doing a sendkeys "ctrl-V" after doing the print screen command. Unfortunately I can't tell you how to get the application to save the file under the called application, except to say that Word has shortcut keys for most of its menu items, such as 'save'. I don't know what paint has.

(in reply to automateddude)
 
 
Post #: 2
 
 Re: Screen Capture and Save - 6/22/2005 4:05:40 PM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
i wrote that screenshot script you are referring to, you just need to change the sleep times to a greater value, i used 1000 and it worked ok. if that isnt enough, make them higher. that script worked for me after that

not sure about passing the file name from another app, but you can change it each time using a variable for the file name

(in reply to automateddude)
 
 
Post #: 3
 
 Re: Screen Capture and Save - 6/23/2005 2:41:54 AM   
  automateddude

 

Posts: 4
Score: 0
Joined: 6/22/2005
From: USA
Status: offline
Sorry about the double post, I posted on the other thread first, and then realized it would probably be better to start a new one.

Actually, my sleep times are 1500. Here is my exact script:

Dim MyVar, objShell, dummy


Set objShell = CreateObject("WScript.Shell")

WScript.Sleep 1500
objShell.SendKeys "%{PRTSC}"
WScript.Sleep 1500
objShell.Run "mspaint"
Wscript.Sleep 1500
objShell.SendKeys "^v"
Wscript.Sleep 1500
objShell.SendKeys "%fs"
WScript.Sleep 1000
objShell.SendKeys "C:\Sales\Support\Isotec\PrintScreen\Test"
WScript.Sleep 1000
objShell.SendKeys "~"

The Paint application starts up and saves the file, but there is nothing to paste to it and the .bmp it saves is blank. I check the Edit menu in Paint after the script is through and the Paste entry is greyed out. I tried increasing the sleep time to 2000, and that didn't work either, but I don't think that's the problem. Again, I'm saving the script with Notepad as a .vbs and running it. Could that be a problem?

(in reply to automateddude)
 
 
Post #: 4
 
 Re: Screen Capture and Save - 6/23/2005 3:42:50 AM   
  sethsdad


Posts: 115
Score: 0
Joined: 4/4/2005
From: USA
Status: offline
Try changing your Sendkeys to {ALT}{PRTSC}

(in reply to automateddude)
 
 
Post #: 5
 
 Re: Screen Capture and Save - 6/23/2005 4:30:34 AM   
  sethsdad


Posts: 115
Score: 0
Joined: 4/4/2005
From: USA
Status: offline
Boy do I feel NOOB. The problem is that your script isn't ever capturing the screen contents. You should be able to re-paste after the script finishes, since paste here doesn't empty the clipboard. Try doing a search of the forum on PRTSC and see if someone has another example.

(in reply to automateddude)
 
 
Post #: 6
 
 Re: Screen Capture and Save - 6/23/2005 8:15:03 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
this worked, not sure why the app.activate makes it not work though.


      

(in reply to automateddude)
 
 
Post #: 7
 
 Re: Screen Capture and Save - 6/29/2005 1:54:10 AM   
  automateddude

 

Posts: 4
Score: 0
Joined: 6/22/2005
From: USA
Status: offline
Kirillian,
I copied and pasted your script verbatim, and it still didn't work. What could be different in our systems that it doesn't work for me? It still saves a blank picture and there is nothing to paste from the clipboard. Is there another tool I could use to capture the screen?

Thanks.

(in reply to automateddude)
 
 
Post #: 8
 
 RE: Re: Screen Capture and Save - 11/1/2006 1:06:02 AM   
  est

 

Posts: 39
Score: 0
Joined: 10/12/2006
Status: offline
Everyone please read Microsoft's script56.chm the sendkeys chapter, you will find a very small notice on the buttom:

[/quote]
Note   You cannot send the PRINT SCREEN key {PRTSC} to an application.
[/quote]

Damn Microsoft!


_____________________________

Do NOT program in a programmer's way

(in reply to automateddude)
 
 
Post #: 9
 
 RE: Re: Screen Capture and Save - 11/1/2006 11:50:18 PM   
  mbouchard


Posts: 1922
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
Damn, you dug far back for this one.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to est)
 
 
Post #: 10
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Screen Capture and Save Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts