wxman1
asked on
Script for Scheduling print jobs
Hello anyone!
I am trying to come up with a script that will aoutmatically look for files and print them at certain times of the day, each day. Is it possible to do this? And if so, how! Thanks in advance!!
-Brian
I am trying to come up with a script that will aoutmatically look for files and print them at certain times of the day, each day. Is it possible to do this? And if so, how! Thanks in advance!!
-Brian
Something like this should work:
Set Root=C:\
Set Pattern=*.txt
For /f "tokens=*" %%i in ('dir %Root%%Pattern% /s /b') do print "%%i"
You can adjust the variables at the top of this script to match your needs. Of course I didn't try this (didn't want to print every .txt file on my machine, but...) You could then use the Windows NT Task Scheduler (at command if on NT4) to schedule this to run whenever you like...
PS: In order to print to a network printer, user running scheduled task must have appropriate permissions and you should look at the /D option for print (print /?). Good luck.
Set Root=C:\
Set Pattern=*.txt
For /f "tokens=*" %%i in ('dir %Root%%Pattern% /s /b') do print "%%i"
You can adjust the variables at the top of this script to match your needs. Of course I didn't try this (didn't want to print every .txt file on my machine, but...) You could then use the Windows NT Task Scheduler (at command if on NT4) to schedule this to run whenever you like...
PS: In order to print to a network printer, user running scheduled task must have appropriate permissions and you should look at the /D option for print (print /?). Good luck.
ASKER
TheMCSE,
I will try what you said thanks.
Oetzy,
Right now just gif images, but possible more in the future!
I will try what you said thanks.
Oetzy,
Right now just gif images, but possible more in the future!
ASKER
TheMCSE,
I tried your script, but nothing happened. I set the root directory to the correct path, and the pattern to the correct file type, but it didn't work.
I tried your script, but nothing happened. I set the root directory to the correct path, and the pattern to the correct file type, but it didn't work.
Does your root path have a trailing backslash? Do you get a file not found message or anything else returned? Post what you have and we will have a look. Regards.
If you open a command prompt and try to execute this command, what do you see?
dir c:\*.gif /s /b
replacing c:\ with the root directory of your choice (notice there are no spaces between the backslash and the asterisk.
If you open a command prompt and try to execute this command, what do you see?
dir c:\*.gif /s /b
replacing c:\ with the root directory of your choice (notice there are no spaces between the backslash and the asterisk.
ASKER
yes it had a trailing backslash.
When i ran dir c:\*.gif /s /b, it couldn't find the directory, but then i thought, its because it is so long with spaces in it so i put quotes around it and it found the files.
so i mdae this change to the bat file, and it started printing. boy did it start printing! I have 2 files in that folder, I just want one printed for now, and as i said it is a gif image, but all that printed was some garbled text. Any further thoughts?
When i ran dir c:\*.gif /s /b, it couldn't find the directory, but then i thought, its because it is so long with spaces in it so i put quotes around it and it found the files.
so i mdae this change to the bat file, and it started printing. boy did it start printing! I have 2 files in that folder, I just want one printed for now, and as i said it is a gif image, but all that printed was some garbled text. Any further thoughts?
OK - try this one:
Change the following line from the script:
For /f "tokens=*" %%i in ('dir %Root%%Pattern% /s /b') do mspaint /p "%%i"
This should work very well.
-Oetzy-
Change the following line from the script:
For /f "tokens=*" %%i in ('dir %Root%%Pattern% /s /b') do mspaint /p "%%i"
This should work very well.
-Oetzy-
ASKER
ok Oetzy
we are getting closer! I changed the code as you suggested, and actually was able to print out half of the image on one page, and half the image on another, and then for some reason it printed 4 more pages with one line of garbled text on each. One problem is this image needs to print out in landscape. any other suggestions?
Brian
we are getting closer! I changed the code as you suggested, and actually was able to print out half of the image on one page, and half the image on another, and then for some reason it printed 4 more pages with one line of garbled text on each. One problem is this image needs to print out in landscape. any other suggestions?
Brian
Do you have MS Word on the according machine?
-Oetzy-
-Oetzy-
ASKER
yes, i do have msword
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ohh... - please remove the line "Word.Visible=true" from the VB script - theres no need for creating a word window for this.
-Oetzy-
-Oetzy-
ASKER
thanks Oetzy!
That did it! Never thought of using VB! Now i just need to configure the script so it zooms the image to fill the page!
Thanks again!
That did it! Never thought of using VB! Now i just need to configure the script so it zooms the image to fill the page!
Thanks again!
was me a divert. :-)
-Oetzy-
-Oetzy-
please tell me what kind of files you want to print (plain text files ??) - maybe I can help you.
-Oetzy-