Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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,

Replies are listed 'Best First'.
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.


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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://987442]
Approved by davido
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2017-10-18 19:08 GMT
Find Nodes?
    Voting Booth?
    My fridge is mostly full of:

    Results (250 votes). Check out past polls.