Jump to content

Recommended Posts

  • Developers

How can I detect if printer is printing a file?

something like this:

$intPrinters = 1

$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Printer")

For $objItem In $colItems
    MsgBox(0,"Printer Info","Printers on " _
             & $objItem.name & ", Printer Number: " & $intPrinters & @LF & _ 
            "====================================" & @LF & _ 
            "Availability: " & $objItem.Availability & @LF & _
            "Description: " & $objItem.Description & @LF & _ 
            "Printer: " & $objItem.DeviceID & @LF & _ 
            "Driver Name: " & $objItem.DriverName & @LF & _ 
            "Port Name: " & $objItem.PortName & @LF & _ 
            "Printer State: " & $objItem.PrinterState & @LF & _ 
            "Printer Status: " & $objItem.PrinterStatus & @LF & _ 
            "PrintJobDataType: " & $objItem.PrintJobDataType & @LF & _ 
            "Print Processor: " & $objItem.PrintProcessor & @LF & _ 
            "Spool Enabled: " & $objItem.SpoolEnabled & @LF & _ 
            "Separator File: " & $objItem.SeparatorFile & @LF & _ 
            "Queued: " & $objItem.Queued & @LF & _ 
            "Status: " & $objItem.Status & @LF & _ 
            "StatusInfo: " & $objItem.StatusInfo & @LF & _ 
            "Published: " & $objItem.Published & @LF & _ 
            "Shared: " & $objItem.Shared & @LF & _ 
            "ShareName: " & $objItem.ShareName & @LF & _ 
            "Direct: " & $objItem.Direct & @LF & _ 
            "Location: " & $objItem.Location & @LF & _ 
            "Priority: " & $objItem.Priority & @LF & _ 
            "Work Offline: " & $objItem.WorkOffline & @LF & _ 
            "Horizontal Res: " & $objItem.HorizontalResolution & @LF & _
            "Vertical Res: " & $objItem.VerticalResolution )
    $intPrinters = $intPrinters + 1
Next

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to post
Share on other sites
  • 1 month later...

i'm working on it

to see the filename, you need to retrieve information about jobs of the printer

i have integrated this function in my admin tool

let's take a look when i will publish it

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
Link to post
Share on other sites

$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\cimv2")
$colInstalledPrinters =  $objWMIService.ExecQuery("Select * from Win32_PrintJob Where Document <> ''")

MsgBox(262144,'Debug line ~38','Selection:' & @lf & '$colInstalledPrinters' & @lf & @lf & 'Return:' & @lf & $colInstalledPrinters & @lf & @lf & '@Error:' & @lf & @Error);### Debug MSGBOX

For $objPrinter in $colInstalledPrinters
    MsgBox(0,'',$objPrinter.Document)
Next

When this is ran and no documents are printing what does the $colInstalledPrinters consist of? I want to make is so that it will alert the user that nothing is in process. By the way this is my first time doing anything like this..... Could some of this be wrote better?

Edited by strate
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Link to post
Share on other sites
  • 1 month later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...