Jump to content

Scheduling a webpage print task


Recommended Posts

Posted

Our school's notices take the form of a web-page which is printed every morning and circulated in registers. Does anyone know how I can schedule the particular web-page to be printed every day at a given time automatically so that a nice big pile of notices is sitting waiting for collection from a printer first thing each morning?

 

Since this would be unattended obviously any solution must not require user input.

Posted

How about:

 

Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "c:\temp\test.htm" 
Wscript.Sleep 1000
objShell.SendKeys "^p" 
WScript.Sleep 1000
objShell.SendKeys "{tab}"
WScript.Sleep 300
objShell.SendKeys "p"
WScript.Sleep 1000
objShell.SendKeys "%"
WScript.Sleep 100
objShell.SendKeys "f"
WScript.Sleep 100
objShell.SendKeys "c"
WScript.Quit 

 

Just change the filename to the html file you wish to open.

 

Ben

Posted
How about:

 

Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "c:\temp\test.htm" 
Wscript.Sleep 1000
objShell.SendKeys "^p" 
WScript.Sleep 1000
objShell.SendKeys "{tab}"
WScript.Sleep 300
objShell.SendKeys "p"
WScript.Sleep 1000
objShell.SendKeys "%"
WScript.Sleep 100
objShell.SendKeys "f"
WScript.Sleep 100
objShell.SendKeys "c"
WScript.Quit 

 

Just change the filename to the html file you wish to open.

 

Ben

 

Couldnt you simplify it and just use this from the site below :

 

http://sastools.com/b2/post/79393894

 

But use it in a vbscript and just use windows scheduling ( http://www.iopus.com/guides/winscheduler.htm ) to assign the vbscript to execute that each morning :)

 

Sendkeys is a bit dangerous considering that you have to ensure that the app or file you need to do things on has to be in focus otherwise you will end up doing other things.

Posted

Option Explicit
Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "rundll32.exe mshtml.dll,PrintHTML test.html"
WScript.Quit 

 

Then.

 

Ben

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...