Solved

print unopened html file

Posted on 2011-03-22
4
428 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 44

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

860 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