Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Help with screen shot

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Help with screen shot
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
 Help with screen shot - 2/16/2005 5:43:11 AM   
  hughewil

 

Posts: 27
Score: 0
Joined: 12/11/2004
From:
Status: offline
Hi,
maybe someone can help me with this.

I have written a script that starts a hummingbird 3270 telnet session, then logs onto CA Sysview, then inputs the proper commands to display the cpu% graph.

Now I need to be able to take a screen shot of the graph from the script.

I am using wscript to start the session from a command prompt. But when I try to do a sendkeys"%{PRTSC}" it doesn't work, I guess you can't send a printscreen sendkeys to a active object. Anyone have any ideas how I could do a screen shot and save it as a image file?

Or as an alternative maybe a screen scrape so I can at least read in the information?
 
 
Post #: 1
 
 Re: Help with screen shot - 2/16/2005 2:33:33 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Interesting, I'm not sure if it can be done with WSH natively. However, if you have a 3rd party screen capture application that supports COM objects, you could use that instead. However, it might be possible to other objects available but I'm unware of those.

(in reply to hughewil)
 
 
Post #: 2
 
 Re: Help with screen shot - 2/16/2005 6:35:53 PM   
  CaffeineAddiction

 

Posts: 144
Score: 0
Joined: 2/9/2005
From:
Status: offline
I know there has to be a way to do it nativly through windows ... but dont know off hand how to do it. What you might want to do instead is look for an .ocx file (scriptable com object) that would allow for taking screen shots

Just out of curiosity ... when you used the sendkey to do a print screen ... how did you decide wether or not it worked? Cause when you hit print screen ... it should copy the .bmp scrap to your clipboard ... or possibly even copy it to a file in your windows temp folder ... and then allows you to past it in a program like paint. Did you try doing a print screen ... then opening up paint (with script) and doing a send key [Ctrl] + V? ... Its a crazy Idea ... but it just might work

I would write a script and try it myself ... but its getting late ... Might do it tommorow.

(in reply to hughewil)
 
 
Post #: 3
 
 Re: Help with screen shot - 2/17/2005 3:46:39 AM   
  hughewil

 

Posts: 27
Score: 0
Joined: 12/11/2004
From:
Status: offline
I know it didn't work because after the script ran I opened paint shop and tried to paste, but there was nothing to paste.

I have however come up with a solution. I downloaded a freeware program called user logger. It takes a screen shot every however minutes you set it at, and saves it as a .gif.

So I run the user logger to take a shot every 4 minutes then I wrote a script that I run as a task every 5 minutes to go and check the folder find the last gif image and move it to a folder on the web server so I can display current CPU usage online.

The only bad thing about user logger is it doesnt take a active window screen shot, it takes a entire window screen shot, so I have to maximize the telnet session and that makes the gif kind of large, but it works.

(in reply to hughewil)
 
 
Post #: 4
 
 Re: Help with screen shot - 2/17/2005 7:51:58 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I'm sure there are some other programs out there that will capture only the active window and perhaps to other formats such as JPG.

(in reply to hughewil)
 
 
Post #: 5
 
 Re: Help with screen shot - 4/13/2005 10:27:51 PM   
  bnwllr

 

Posts: 3
Score: 0
Joined: 4/13/2005
From:
Status: offline
Hi,

I'm looking for similar help - I need a way of taking screen shots (to then compare, which is easy) of an array or list of web pages - any ideas on best way to capture the images and store as gifs / jpegs?

As the images are to be compared, it has to be only the active window (so not to include any time / date that will change etc). Running on windows...

Another smaller problem is ensuring the page is fully loaded before capturing the shot (maybe just using a looped pause initially?).

Any help / pointers would be great

(in reply to hughewil)
 
 
Post #: 6
 
 Re: Help with screen shot - 4/14/2005 9:23:56 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I'm not entirely sure on what exactly you intend to do, but it doens't sound feasible using any scripting alone. How can you capture a screen shot of a bunch of web pages (or any Window for that matter), extrat the images and store them as JPGs, and compare them ?

I'm at a lost.

(in reply to hughewil)
 
 
Post #: 7
 
 Re: Help with screen shot - 4/14/2005 5:44:09 PM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
im working on this, i think its a neat idea and ive gotten it partially working. i will post it tomorrow if i get time.

(in reply to hughewil)
 
 
Post #: 8
 
 Re: Help with screen shot - 4/14/2005 7:16:21 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I guess I misunderstood what he wanted. Could you post your scripts please. It sounds interesting.

Thanks.

(in reply to hughewil)
 
 
Post #: 9
 
 Re: Help with screen shot - 4/15/2005 1:34:14 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
here it is, you would have to modify the filename so you dont get the overwrite message each time. Note that I used the normal parenthesis rather than the squiggly ones in the sendkeys statement. The pause between the sendkeys is required as well otherwise its too fast.

reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp


      

(in reply to hughewil)
 
 
Post #: 10
 
 Re: Help with screen shot - 4/16/2005 2:58:10 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
i guess i was too late out of the gate on this one lol

(in reply to hughewil)
 
 
Post #: 11
 
 Re: Help with screen shot - 4/16/2005 4:31:19 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I would just use some 3rd party tools for this and perhaps use vbs for the comparison. Not that I have any idea why someone wants to do that though.

(in reply to hughewil)
 
 
Post #: 12
 
 Re: Help with screen shot - 4/17/2005 9:36:36 PM   
  bnwllr

 

Posts: 3
Score: 0
Joined: 4/13/2005
From:
Status: offline
Thanks for your help Kirrilian - your script was great. I actually ended up using Ruby though, to allow easier walkthrough within webpages (filling in forms, submitting etc) to get to n-level deep pages, and then used Windows API to print the page to default printer which prints to .jpg file (if you can follow that?!) - acually works really well, and the printer driver handles naming of files etc. so fully automated from the script. The reason i'm doing it Token is for automated QA testing of my webpages, so script walks through some procedures and takes a screen shot which can then be compared with the last set of shots to ensure consistency after making back office amendments. Then I just compare old / new and keep the one which is best.

(in reply to hughewil)
 
 
Post #: 13
 
 Re: Help with screen shot - 4/18/2005 3:42:54 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
ah.. I see. Would you mind posting the scripts you had and/or any additional URLs (such as for Ruby) so we can take a look ? It sounds like an interesting project ;)

(in reply to hughewil)
 
 
Post #: 14
 
 Re: Help with screen shot - 4/18/2005 8:18:54 PM   
  bnwllr

 

Posts: 3
Score: 0
Joined: 4/13/2005
From:
Status: offline
I use Watir addon to Ruby, designed for web testing; http://wtr.rubyforge.org/
and just harnessed the ExecWB command from the IE API to print the current page to my default printer driver (http://www.zan1011.com/dev.htm) which allows printing to file. I run a batch file for a selection of tests, setting the range of file names before each test to ensure that the .jpgs produced will correspond each time the batch is run (e.g. if test 2 fails at step 4, and therefore misses the rest of the steps and moves to test 3, I want the image names to represent this to ensure that previousImg2_5.jpg isn't being compared to currentImg3_1.jpg etc).

(in reply to hughewil)
 
 
Post #: 15
 
 Re: Help with screen shot - 4/19/2005 8:52:48 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Awesome!. Thanks alot =)

(in reply to hughewil)
 
 
Post #: 16
 
 Re: Help with screen shot - 4/20/2005 12:29:25 AM   
  mbouchard


Posts: 1916
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
While I am late to the thread, here is a dll I came across that might be useful.

http://www.autoitscript.com/forum/index.php?showtopic=8377&hl=

(in reply to hughewil)
 
 
Post #: 17
 
 Re: Help with screen shot - 5/29/2005 10:06:13 PM   
  rudrarup


Posts: 58
Score: 0
Joined: 5/26/2005
From: Pune
Status: offline
quote:
Originally posted by kirrilian

here it is, you would have to modify the filename so you dont get the overwrite message each time. Note that I used the normal parenthesis rather than the squiggly ones in the sendkeys statement. The pause between the sendkeys is required as well otherwise its too fast.

reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp


      


(in reply to hughewil)
 
 
Post #: 18
 
 Re: Help with screen shot - 6/22/2005 4:39:46 AM   
  automateddude

 

Posts: 4
Score: 0
Joined: 6/22/2005
From: USA
Status: offline
Hi,
This might be just the thread I've been looking for. I want to capture the screen as well, but not for a web application. I have an application that can call vbscript, but when I try to use the script posted here to do a screen capture, it doesn't work. The Microsoft documentation actually says that you can't send the {PRTSC} key to any application. What I did was copy the script into Notepad and saved it with a .vbs extension. Then I ran it and it ran calculator and paint, but it didn't paste anything and saved an empty .jpg. What did I do wrong?

(in reply to hughewil)
 
 
Post #: 19
 
 Re: Help with screen shot - 6/22/2005 4:07:31 PM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
as i posted on your other post, increase the sleep time to 1000 and try it again

(in reply to hughewil)
 
 
Post #: 20
 
 
Page:   [1] 2   next >   >>
 
  

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 >> Help with screen shot Page: [1] 2   next >   >>
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