Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Keep It Simple, Stupid
 
PerlMonks  

clear print queue

by Anonymous Monk
on Aug 14, 2012 at 19:26 UTC ( #987442=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello PerlMonks,

There are mutiple print services running on a Windows machine and I need to clear the print queue after printing some set of document. May I know how I can achieve that in Perl.

Thanks in Advance,
Peter

Comment on clear print queue
Re: clear print queue
by davido (Archbishop) on Aug 14, 2012 at 19:42 UTC

    Win32::API provides a Perlish means of calling functions from Win32's Dynamic Link Libraries. It's an interface with the Win32 API, as its name suggests.

    So armed with that tool, the question changes. Now you know how to deal with the Windows API from Perl. At this point rather than asking how to do it with Perl, you can ask how to clear the print queue using the Windows API. It turns out there are a lot more people who know how to manipulate the Windows API than there are who know both the Windows API and Perl. So by using Win32::API, you get to abstract away the details of how to accomplish a task in Perl, and re-focus on how to accomplish the task irrespective of the language used to implement the solution.

    And if you do get stuck on the Perl side of things, you'll be able to ask a question about Win32::API instead of about the specific API-manipulation objective. Once again, this type of generalization benefits you, since there are more people who understand the Win32::API module than there are who have specific experience with manipulating the print queue from Perl.

    In this way your question which at the outset seems too localized to be answered by any more than a few individuals can be broken into two questions, each of which can be answered by thousands of individuals even if there's no intersection between those two groups.


    Dave

Re: clear print queue
by rpnoble419 (Pilgrim) on Aug 15, 2012 at 22:35 UTC
    You may want to look at this module Win32::Printer::Enum. I use the base module all the time in my apps...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://987442]
Approved by davido
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2014-04-21 01:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (489 votes), past polls