Solved

print unopened html file

Posted on 2011-03-22
4
419 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 41

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.

708 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

18 Experts available now in Live!

Get 1:1 Help Now