u8dmtm Posted September 26, 2006 Posted September 26, 2006 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.
plexer Posted September 26, 2006 Posted September 26, 2006 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
mac_shinobi Posted September 26, 2006 Posted September 26, 2006 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.
ChrisH Posted September 26, 2006 Posted September 26, 2006 AutoIt us bette for sending keys and making sure windows are active etc.
plexer Posted September 26, 2006 Posted September 26, 2006 Option Explicit Dim objShell Set objShell = CreateObject("WScript.Shell") objShell.Run "rundll32.exe mshtml.dll,PrintHTML test.html" WScript.Quit Then. Ben
ChrisH Posted September 26, 2006 Posted September 26, 2006 Or you could just cut that down to one line with a batch script...... nah I'm joking VBS always behaves nicer in most circumstances.
webman Posted September 26, 2006 Posted September 26, 2006 Or schedule rundll32.exe to run with the parameters mshtml.dll,PrintHTML test.html ... 8)
plexer Posted September 26, 2006 Posted September 26, 2006 That'd do it as well. I'm going to give up I think. Ben
webman Posted September 26, 2006 Posted September 26, 2006 I take it somebody's had their head buried in a VBScript help file/manual all day then Ben?
plexer Posted September 26, 2006 Posted September 26, 2006 Not really no just been looking at stuff throughout the day I tested my senkeys one and it worked ok but there are other ways too. Ben
NetworkGeezer Posted September 26, 2006 Posted September 26, 2006 Or schedule rundll32.exe to run with the parameters mshtml.dll,PrintHTML test.html ... 8) I see you brought your razor Mr. Occam
u8dmtm Posted September 26, 2006 Author Posted September 26, 2006 Thanks for all those sugestions, its working fine now.
ITWombat Posted September 26, 2006 Posted September 26, 2006 I see you brought your razor Mr. Occam As this is EduGeek that should be I see you brought your iron Mr. Sheppard
webman Posted September 26, 2006 Posted September 26, 2006 I'm getting board of all these ironing jokes now :? Sorry 8)
GrumbleDook Posted September 26, 2006 Posted September 26, 2006 Really? They have me creased up usually. And I am glad the other esteamed members think it is funny too. I tried to resist ... honest!!!
john Posted September 26, 2006 Posted September 26, 2006 I hope you will be wearing a shirt with an Iron on it then we can all spot ya easy at Bett and other shows etc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now