?
Solved

Batch print HTML files

Posted on 2007-11-14
10
Medium Priority
?
3,470 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

765 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