?
Solved

print unopened html file

Posted on 2011-03-22
4
Medium Priority
?
436 Views
Last Modified: 2012-06-22
I've saved an html page from the internet onto my PC and want to print the rendered content without opening it.

What I want to happen is for the Internet Explorer 8 Print Dialog box to automatically appear so I can manually get it to print, in the same way as if I had selected the file in Windows Explorer and chosen Print on the "right-click mini menu."

You'll see from my code snippet that I have found a suggested solution elsewhere but it doesn't do anything when I click the doprint.vbs from Windows Explorer.


SUGGESTED DOPRINT.VBS WAY TO PRINT UNOPENED HTML FILE. NOTHING HAPPENS?

surl="mypage.html"    'your input

dim bpttd_ready, istatus
set oie=wscript.createobject("internetexplorer.application","ie_")
do while oie.readystate<>4 : wscript.sleep 50 : loop
on error resume next
istatus=oie.querystatuswb(6)
if err.number<>0 then    
    wscript.echo "Cannot find the printer. Operation aborted."
    oie.quit
    set oie=nothing
    wscript.quit err.number
end if
on error goto 0
oie.navigate surl
do while oie.readystate<>4 : 
wscript.sleep 50 : loop
bpttd_ready=false
oie.execwb 6,2
do while not bpttd_ready : wscript.sleep 50 : loop
oie.quit
set oie=nothing
wscript.quit

sub ie_PrintTemplateTeardown(pDisp)
    bpttd_ready=true    'global bpttd_ready; no dim here
end sub

Open in new window

0
Comment
Question by:NEILPH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 47

Expert Comment

by:Jackie Man
ID: 35199490
What is your OS?
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 2000 total points
ID: 35199703
You should be able to do this using shellexecute:

Introducing ShellExecute()
http://www.ml-consult.co.uk/foxst-26.htm
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 35200741
Yes, ShellExecute() should work perfectly.
0
 

Author Closing Comment

by:NEILPH
ID: 35202293
Brilliant.

It worked a treat.

Incidentally, I'm using VFP 9.0 SP2 in Windows Vista.
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question