screen shot withou word object

93 views
Skip to first unread message

dhirendra soni

unread,
May 30, 2013, 5:15:45 AM5/30/13
to mercu...@googlegroups.com
Hi All,
I have below code to take snapshot on any active open window but what if the
 system is not installed with the mS word, then it fails.
Any idea??


'Taking Screenshot using word object
Set oWordBasic = CreateObject("Word.Basic")
oWordBasic.SendKeys "{prtsc}"
oWordBasic.AppClose "Microsoft Word"
Set oWordBasic = Nothing
WScript.Sleep 2000
 
'Opening Paint Application
set WshShell = CreateObject("WScript.Shell")
WshShell.Run "mspaint"
WScript.Sleep 2000
 

'Activating Paint Application
WshShell.AppActivate "untitled - Paint"
WScript.Sleep 1000
 
'Paste the captured Screenshot
WshShell.SendKeys "^v"
WScript.Sleep 500
 
'Save Screenshot
WshShell.SendKeys "^s"
WScript.Sleep 500
WshShell.SendKeys "c:\test.bmp"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
 
'Release Objects
Set WshShell=Nothing
WScript.Quit

nikhil gangwar

unread,
May 31, 2013, 3:11:18 AM5/31/13
to mercu...@googlegroups.com
Hi Dhirendra,

You can try

Desktop.CaptureBitmap("Filename.png or .bmp",True) to capture screen shot.

You can give your file name on run time.


Thanks
Nikhil Gangwar


--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to Mercu...@googlegroups.com
To unsubscribe from this group, send email to
MercuryQTP+...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
 
---
You received this message because you are subscribed to the Google Groups "QTP - HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mercuryqtp+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages