Jump to content

Delete all printer jobs


 Share

Recommended Posts

10x for your support. Maybe I have a problem to run vbs files, because nothing happen... again. Maybe have a problem to put printer real name. This is the printer path:

\\server\printer

I try to put the name, and the full path, but nothing.

I will think to clean jobs in other way, coz this don't work. The crazy think is that the script who cleans all printers works! But when I try to tell him one printer - nothing.

10x again for your help.

If anybody know other way to clean printer jobs, please post it here.

Link to comment
Share on other sites

10x for your support. Maybe I have a problem to run vbs files, because nothing happen... again. Maybe have a problem to put printer real name. This is the printer path:

\\server\printer

I try to put the name, and the full path, but nothing.

I will think to clean jobs in other way, coz this don't work. The crazy think is that the script who cleans all printers works! But when I try to tell him one printer - nothing.

10x again for your help.

If anybody know other way to clean printer jobs, please post it here.

@littleclown

The means by which you are trying to clean out the print jobs is correct. Check the CompInfo library in my signature. It uses _ComputerGetPrinters(). You can use the example to get the exact name of the printer. (It may be different than you think)

I haven't added the Methods/Functions (CancelAllJobs()) to my functions yet, but I think I can help you. I need to ask a few questions.

Are the printer drivers installed locally? (If that is the case you shouldn't have to access the server directly through $strComputer)

You may consider having the script list through the printer names, and allowing you to select one to CancelAllJobs on. That way you are sure there are no typo's in your printer name.

Try my library example of _ComputerGetPrinters(), and let me know if it properly returns the name for you.

I hope I can help,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

01. I use _GetAllPrinters() from somewhere and works in other case. The printer name is this, but I don't know can I use just the name or full path (i tried both).

02. I think the drivers are installed on the server. But my printer is popular and have drivers in my PC too I think (but the print server use the drivers)

I don't know what typo's mean. My printer name is like XXX00XXX00XXX_0 alphabetical and numbers chars only (and "_" char).

Link to comment
Share on other sites

01. I use _GetAllPrinters() from somewhere and works in other case. The printer name is this, but I don't know can I use just the name or full path (i tried both).

02. I think the drivers are installed on the server. But my printer is popular and have drivers in my PC too I think (but the print server use the drivers)

I don't know what typo's mean. My printer name is like XXX00XXX00XXX_0 alphabetical and numbers chars only (and "_" char).

Do all the printers have jobs on them, or just one in particular? What you could do instead of worrying about clearing say just that one is set it to clear all the printers before you get there in the morning. Say at 2 - 5 am.

Also another way you can go about this other than the name is through PrinterStatus.

Also _ComputerGetPrintJobs() can give you the name of a particular printer that has jobs.

I hope this helps some.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Some have jobs, some haven't. This printer is the only one who must be cleaned every morning (but needs some actions before that, and thats why i must start this clean manually (i will put this in bigger script))

Can you run my _ComputerGetPrinters(), and show me the output from it? You can use the Examples file, and change it from a message box to something that writes to a text file.

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I attached the shot of msgbox (i am so lazy ;)).

Okay lets see if we can get this working for you.

Local $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20    
Local $colItems, $objWMIService, $objItem
    
$objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Printer WHERE Name = '\\Sof11srv002\SOF11PRT12ALC_1'", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    
If IsObj($colItems) Then
    For $objItem In $colItems
        $objItem.CancelAllJobs()
    Next
Else
    MsgBox(0, "ERROR!", "The object was not created.")
EndIf

Try that. Let me know how it works for you.

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

$cI_Compname = "localhost" - nothing

$cI_Compname = "Sof11srv002" - error: "Script.au3 (6) : ==> Variable must be of type "Object".:"

10x for this try. ;)

Try my _ComputerGetPrintJobs(), and tell me what that returns if anything. (When that printer has a job)

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

This is one job from this printer.

This jobs are done, but the queue "remember" them. I wont to clean done and no done jobs. (Cool English :P)

Now when you say jobs are "queued" that means that isn't print in progress, the question being; is that the local queue or the queue on the server? What was the $cI_CompName that you used? localhost? (default)

Have you tried the following? (Below assumes you used "localhost" on the above picture)

Local $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20   
Local $colItems, $objWMIService, $objItem
   
$objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Printer WHERE Name = 'HP LaserJet 2420 PCL 5e'", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
   
If IsObj($colItems) Then
    For $objItem In $colItems
        $objItem.CancelAllJobs()
    Next
Else
    MsgBox(0, "ERROR!", "The object was not created.")
EndIf

Edit: Punctuation

Keep trying,

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...