Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

automate some printing

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-12-2008   #1 (permalink)
Ben Christian
Guest


 

automate some printing

i need to automate some printing...

basically i need the script to check for files in a directory (generally
they'll all be PDF).

for each file it finds, it needs to print it, then move it into a different
directory.

it'd be nice if it could confirm a successful print
it'd also be nice if there's a way to obtain the printer status prior to
printing (i.e. out of paper, low on toner, etc).

i know how to write the foreach file stuff, but how do i call the file, open
it, and tell it to print, then check for successful print...

thanks!!


My System SpecsSystem Spec
Old 03-13-2008   #2 (permalink)
Marco Shaw [MVP]
Guest


 

Re: automate some printing

Ben Christian wrote:
Quote:

> i need to automate some printing...
>
> basically i need the script to check for files in a directory (generally
> they'll all be PDF).
>
> for each file it finds, it needs to print it, then move it into a different
> directory.
>
> it'd be nice if it could confirm a successful print
> it'd also be nice if there's a way to obtain the printer status prior to
> printing (i.e. out of paper, low on toner, etc).
>
> i know how to write the foreach file stuff, but how do i call the file, open
> it, and tell it to print, then check for successful print...
>
> thanks!!
>
What kind of environment do you have? You have a print server? You can
typically query the status of a printer using WMI (get-wmiobject). In
addition, you may be able to get the printer status:
http://msdn2.microsoft.com/en-us/lib...63(VS.85).aspx. There's
a very useful PrinterState property, but it looks like it is deprecated.

As for how to open the file and print, what do you have? Do you have an
Office plugin for dealing with PDF docs? You could use Adobe Reader,
but you'd have to go with keystroke automation as I'm not aware of any
scripting API for Adobe's PDF reader.

As for checking for a successful print, assuming you end up using Word
2007 to print the document, I'm not sure if the print() method will
return an appropriate code, or you may have to go to the print server or
printer to find out how you might be able to get the info. With a print
server, you may need to check if there's sufficient auditing to get that
info.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 03-17-2008   #3 (permalink)
Ben Christian
Guest


 

Re: automate some printing

It looks like it will need to be keyboard automation then. i've never done
keyboard automation in powershell before...do you have any good resources i
could reference?

To answer your questions - it would use a print server, and Adobe Reader.

Thanks!

"Marco Shaw [MVP]" wrote:
Quote:

> Ben Christian wrote:
Quote:

> > i need to automate some printing...
> >
> > basically i need the script to check for files in a directory (generally
> > they'll all be PDF).
> >
> > for each file it finds, it needs to print it, then move it into a different
> > directory.
> >
> > it'd be nice if it could confirm a successful print
> > it'd also be nice if there's a way to obtain the printer status prior to
> > printing (i.e. out of paper, low on toner, etc).
> >
> > i know how to write the foreach file stuff, but how do i call the file, open
> > it, and tell it to print, then check for successful print...
> >
> > thanks!!
> >
>
> What kind of environment do you have? You have a print server? You can
> typically query the status of a printer using WMI (get-wmiobject). In
> addition, you may be able to get the printer status:
> http://msdn2.microsoft.com/en-us/lib...63(VS.85).aspx. There's
> a very useful PrinterState property, but it looks like it is deprecated.
>
> As for how to open the file and print, what do you have? Do you have an
> Office plugin for dealing with PDF docs? You could use Adobe Reader,
> but you'd have to go with keystroke automation as I'm not aware of any
> scripting API for Adobe's PDF reader.
>
> As for checking for a successful print, assuming you end up using Word
> 2007 to print the document, I'm not sure if the print() method will
> return an appropriate code, or you may have to go to the print server or
> printer to find out how you might be able to get the info. With a print
> server, you may need to check if there's sufficient auditing to get that
> info.
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to automate ftp using powershell? Jeffery Jensen PowerShell 4 03-10-2008 08:15 AM
How to automate .msu installation ? Goldrake Vista General 1 12-14-2007 07:58 PM
automate iis client cert mapping erick PowerShell 2 02-19-2007 09:33 PM
ANN: FinalBuilder action to automate PowerShell Peter Thornqvist PowerShell 0 11-08-2006 06:02 PM
Using PowerShell to automate FTP transfers =?Utf-8?B?RGF2aWRUTQ==?= PowerShell 16 09-28-2006 01:11 PM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008