Solved

print unopened html file

Posted on 2011-03-22
4
424 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
4 Comments
 
LVL 43

Expert Comment

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

Accepted Solution

by:
PaulHews earned 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

813 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now