Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
The IADsPrintJob interface can be used to configure print job properties while those print jobs are in the print queue. Typically, this is done to control the order in which documents, especially large documents that might monopolize printer time, are printed.
For example, suppose you have several large (more than 400 KB) print jobs in the print queue, along with a number of smaller print jobs. You might want the small print jobs to print first so that those users do not have to wait for the larger jobs to finish. In this scenario, you want jobs to print in this order:
In this case, pausing the larger print jobs will not suffice. After all, while those jobs are paused, any new jobs added to the print queue will move ahead of them in the queue.
Instead, you can change the priority of each print job. For example, jobs less than 400 KB can be given a priority of 3. Because higher-priority jobs print first, these jobs will immediately move to the head of the print queue. Print jobs greater than 400 KB can be given a priority of 2. Any new jobs that are sent to the print queue will have the default priority of 1. As a result, they will not be printed until after the larger print jobs have finished.
You must use the WinNT provider to bind to and configure print jobs; the LDAP provider does not support the IADsPrintJob interface. This means your script has to bind to a specific printer on a specific print server using a format similar to the following:
Set objPrinter = GetObject(
"WinNT://printserver1/financeprinter
")
You can control the order in which a job prints in several ways. For example:
Listing 13.20 contains a script that changes the priority of a print job. To carry out this task, the script must perform the following steps:
Because the LDAP provider does not support binding to print jobs, you must use the WinNT provider and bind to a specific printer on a specific print server.
Job priorities are set using the Put method and the following two parameters:
Listing 13.20 Changing Print Job Priority
|
|
Another way to postpone the printing of large documents is to change the start time for that print job. For example, the script shown in Listing 13.21 changes the start time for all documents greater than 400,000 bytes to 2:00 A.M. To carry out this task, the script must perform the following steps:
Because the LDAP provider does not support binding to print jobs, you must use the WinNT provider and bind to a specific printer on a specific print server.
Job priorities are set by using the Put method and the following two parameters:
Listing 13.21 Changing the Start Time of a Print Job
|
|
Send us your feedback | « Previous | Next » |