Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print screen

Status
Not open for further replies.

Per9922

IS-IT--Management
Oct 1, 2004
74
0
0
SE
Hello,

I have an application there I would like to print the screen. It is possible from VBScript to print the screen ? I have two monitors to my application, can I seléct which monitor I would like to print ?

Thanks Per
 
Hello xwb,

Thanks for the response. Maybe I explained alittle bad. My application will be on two monitors. The two minitprs work independent. I would like to have button on each monitors that prints the contest of that monitor.

Regards
Per
 
Painstakingly... You'll need a separate program to capture the screen because a print screen cannot be sent to an application via a script.

If it could, however, this is you could do it.
Use keystrokes to capture the screen, paste to a document and then print

Code:
set objShell = CreateObject("WScript.Shell")

'capture screen
objShell.sendKeys "{PRTSC}"
wscript.sleep 500

'open wordpad and "wait until ready"*
objShell.run "wordpad"
do 
	ready = objShell.AppActivate ("wordpad")
	wscript.sleep 1000
loop until ready = true
wscript.sleep 500

'paste (send CTRL + v) and wait for a second
objShell.sendKeys "^v"
wscript.sleep 500

'open print dialog (send CTRL + p)
objShell.sendKeys "^p"
wscript.sleep 500

'print (send ALT + p)
objShell.sendKeys "%p"

*Scripts tend to run faster than GUI application. AppActivate will return True when ready so use it in a loop bring focus to the app and proceed when ready

-Geates

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top