Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 21st, 2008, 05:06 AM
scriptfreak scriptfreak is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 9 scriptfreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 38 sec
Reputation Power: 0
WMI - Accessing PrintJob

Is there a way to identify the Print preferences from print job. Say, the total number of copies of the document, the duplex property, number of pages per sheet etc.

Was able to retrieve only the total number of pages from Win32_PrintJob .

Any help on these issues will be much helpful. Thanks in advance.

Reply With Quote
  #2  
Old May 23rd, 2008, 09:27 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by scriptfreak
Is there a way to identify the Print preferences from print job. Say, the total number of copies of the document, the duplex property, number of pages per sheet etc.

Was able to retrieve only the total number of pages from Win32_PrintJob .

Any help on these issues will be much helpful. Thanks in advance.
Use the Win32_PrinterConfiguration class.
__________________
Click the image if at any point you don't like my decision.

Scripting problems? Windows questions? Ask the Windows Guru!


Reply With Quote
  #3  
Old May 26th, 2008, 12:37 AM
scriptfreak scriptfreak is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 9 scriptfreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by Nilpo
Use the Win32_PrinterConfiguration class.


Nope. Win32_PrinterConfiguration will not help. It just says the printer configuration of installed printers in your machine and not the print queue's job. Print queue's configuration need not be required to be same as that of printer configuration's. For example, try changing the printer configuration while u give print from PDF doc or so.

Am in search of this for a long time, yet to get a soln

Reply With Quote
  #4  
Old May 26th, 2008, 06:57 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Printer settings (page orientation, background printing, etc.) are not associated with individual print jobs. They are global printer settings that can be changed between print jobs.

Now if you are referring to document settings (i.e. print margins, etc.), those need to be changed in the host app prior to printing and cannot be manipulated once a print job is queued.

Reply With Quote
  #5  
Old May 26th, 2008, 07:09 AM
scriptfreak scriptfreak is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 9 scriptfreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by Nilpo
Printer settings (page orientation, background printing, etc.) are not associated with individual print jobs. They are global printer settings that can be changed between print jobs.

Now if you are referring to document settings (i.e. print margins, etc.), those need to be changed in the host app prior to printing and cannot be manipulated once a print job is queued.


Lemme explain a bit more of what am trying to achieve.

Say my printer settings is set to Duplex None.

When I fire a print out from an application say Adobe Reader. I can very well change the printer configurations by clicking on the print properties. Say am changing the property to Flip on Long Edge. This printer setting is valid for this print job.

Am doing a programmatic pause whenever a print job is created. I can now see(visually, when i open up the corresponding printer[right click printer-> Open]) for the configurations set in my pdf print properties. If there is a way to check this visually, can't this be retrieved programatically ?

Am not interested in changing any of the settings, just a retrieval of the existing settings from print job.

Reply With Quote
  #6  
Old May 26th, 2008, 07:14 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
Quote:
Originally Posted by scriptfreak
Lemme explain a bit more of what am trying to achieve.

Say my printer settings is set to Duplex None.

When I fire a print out from an application say Adobe Reader. I can very well change the printer configurations by clicking on the print properties. Say am changing the property to Flip on Long Edge. This printer setting is valid for this print job.

Am doing a programmatic pause whenever a print job is created. I can now see(visually, when i open up the corresponding printer[right click printer-> Open]) for the configurations set in my pdf print properties. If there is a way to check this visually, can't this be retrieved programatically ?

Am not interested in changing any of the settings, just a retrieval of the existing settings from print job.
I understand what you are asking and I'm again pointing you to the Win32_PrinterConfiguration class. You need to poll this class immediately before or while that specific job is being executed.

The Win32_PrinterConfiguration class does not return the default printer options. It returns the real-time settings at the time the query is executed.

Reply With Quote
  #7  
Old May 26th, 2008, 09:24 AM
scriptfreak scriptfreak is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 9 scriptfreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by Nilpo
I understand what you are asking and I'm again pointing you to the Win32_PrinterConfiguration class. You need to poll this class immediately before or while that specific job is being executed.

The Win32_PrinterConfiguration class does not return the default printer options. It returns the real-time settings at the time the query is executed.


Hey Nilpo, Win32_PrinterConfiguration doesn't help. It gives us the default printer settings and not the print job's. I tried this with pausing the print job and then executing the printer configuration.

Please find below the code snippet used for doing the same. Please lemme know if my understanding is correct.
' Print job is paused at this point
Set objPrintersConfiguration = objWMIservice.ExecQuery("SELECT * FROM Win32_PrinterConfiguration")
For Each objPrinterConfiguration in objPrintersConfiguration
If printerName(0) = objPrinterConfiguration.Name Then
Wscript.Echo "objPrinterConfiguration.Duplex " & objPrinterConfiguration.Duplex
End If
Next

Reply With Quote
  #8  
Old May 26th, 2008, 12:53 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
I don't see any way to do this from WMI. It would seem that you are going to need to find a way to read the actual spooled job file. These can be found in %systemroot%\System32\spool\PRINTERS. These files differ for each printer (driver) in use so I can't really help any further unless I know what model printer, etc or have a sample print job to look at.

Reply With Quote
  #9  
Old May 29th, 2008, 08:55 AM
scriptfreak scriptfreak is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 9 scriptfreak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 39 m 38 sec
Reputation Power: 0
Quote:
Originally Posted by Nilpo
I don't see any way to do this from WMI. It would seem that you are going to need to find a way to read the actual spooled job file. These can be found in %systemroot%\System32\spool\PRINTERS. These files differ for each printer (driver) in use so I can't really help any further unless I know what model printer, etc or have a sample print job to look at.


Thanks for your help Nilpo. Am really surprised that there is no way in reading the lay out properties of a print job while I could read the general properties of the same using Win32_PrintJob .

I tried out for reading out the shadow files which gets created in the directory mentioned. But unfortunately, am getting a shared access violation for the same. Is there a way by which i can read these files. And how to do the same in case of network printers? Will these files gets created in print servers ? Further, is it advisable to read these files.

Reply With Quote
  #10  
Old May 29th, 2008, 11:12 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,254 Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)Nilpo User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 6 Days 10 h 25 m 34 sec
Reputation Power: 667
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
The problem is that each print driver uses a proprietary format for creating these files. And they are in use anytime the job is paused. As for network printers, these files should be located on whatever machine the job was spooled from.

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > WMI - Accessing PrintJob


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump