Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Batch print HTML files

Posted on 2007-11-14
10
Medium Priority
?
3,566 Views
Last Modified: 2008-02-01
I have been trying for a while to create a batch file that will get all *.html files in a specfic directory and batch print them I have tried everything I know and spent days on the net. Does anyone know if this is even possible? Oh the other problem is that the printer is the default network printer!!! Any help would be greatly appreciated.

@echo off
c:
net use lpt1: /delete /y
net use lpt1: \\vactor_wts_nt1\mislaser
 
cd C:\Program Files\Internet Explorer
iexplore.exe /p /h C:*.html
pv -k -f iexplore.exe
 
Exit

Open in new window

0
Comment
Question by:roberta
[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
  • 3
  • 3
10 Comments
 
LVL 9

Expert Comment

by:MSE-dwells
ID: 20289060
Are you trying to print the html source or the rendered page?
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 20289228
To print the source you can use the vbscript from this article:
http://www.microsoft.com/technet/scriptcenter/resources/qanda/dec05/hey1206.mspx

Unfortunately odd things seem to happen when printing .html files with it, so rename them all to .txt first using a command like this:
ren c:\documents\*.html *.txt

Then rename them back afterwards.
0
 
LVL 9

Expert Comment

by:MSE-dwells
ID: 20289496
Nod, sadly though I'm guessing the OP wants the rendered content -- got anything for that too?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 38

Expert Comment

by:Shift-3
ID: 20290597
Ok, found a way.

1. Create a page containing links to all the other pages.  You can use a command like the one attached below (remember to change all instances of %G to %%G if you put it in a batch file).

2. Open list.htm in Internet Explorer.

3. Go to File|Print.

4. Select the desired printer, then go to the Options tab.

5. Check the "Print all linked documents" box, then click Print.

I got the idea from this page:
http://lists.evolt.org/archive/Week-of-Mon-20011029/060218.html
for /F "tokens=*" %G in ('dir *.html /B') do echo ^<A HREF="%G"^>%G^</A^> >> list.htm

Open in new window

0
 
LVL 9

Expert Comment

by:MSE-dwells
ID: 20290619
Nice idea ... like it.  Hopefully, that'll meet the OP's requirements?
0
 

Author Comment

by:roberta
ID: 20293031
Actually they are orders that are exported from an oracle based ERP system. Every night they are deposited in a network directory then retrieved one by one and printed accordingly. They were previously PDF files which I had written a batch file to print. Now the same command lines (modified of course) will not work.
0
 

Author Comment

by:roberta
ID: 20294997
I have tried the "list.htm" solution very clever but, the person/people who will be using this is a point and click user only. So any tips on writing an actual batch file or a standalone vbs script would be perfect. Thank you though for that tip it really is very cool.
0
 
LVL 38

Expert Comment

by:Shift-3
ID: 20298081
Well, if you save the code below in a .cmd file and put it on their desktop then all they have to do is double-click it and go through printing steps 3-5.  I don't think it will get any friendlier than that without a specialized batch printing program.


@echo off
setlocal
 
REM The folder containing the .html files
set target=s:\JDE files
 
if exist "%temp%\list.htm" del "%temp%\list.htm"
 
for /F "tokens=* usebackq" %%G in (`dir "%target%\*.html" /B`) do echo ^<A HREF="%%G"^>%%G^</A^> >> "%temp%\list.htm"
 
"%programfiles%\internet explorer\iexplore.exe" "%temp%\list.htm"
 
endlocal

Open in new window

0
 
LVL 38

Accepted Solution

by:
Shift-3 earned 2000 total points
ID: 20298521
Whoops, had an error.
@echo off
setlocal
 
REM The folder containing the .html files
set target=s:\JDE files
 
if exist "%target%\list.htm" del "%target%\list.htm"
 
for /F "tokens=* usebackq" %%G in (`dir "%target%\*.html" /B`) do echo ^<A HREF="%%G"^>%%G^</A^> >> "%target%\list.htm"
 
"%programfiles%\internet explorer\iexplore.exe" "%target%\list.htm"
 
endlocal

Open in new window

0
 

Author Comment

by:roberta
ID: 20312018
Thank you so much for the solution. The person who will be using it is more than happy to be clicking a couple of batch files rather than printing 50 or 60 documents individually.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

636 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