Sign in to follow this  
Followers 0
petrosky

Help refreshing Internet Explorer default printer.

1 post in this topic

#1 ·  Posted (edited)

Hi,

I have a user who is required to browse to an intranet pricelist and then print out a certain number of copies to various printers around the company.

I have the following script that sets the default printer and prints out the quanties...but while the IE window remains open it seems to have cached the printer selected. This means that all the print jobs go to the first printer set.

If anyone has a better way of doing this or any ideas they will be much appreciated.

#Include <WinAPI.au3>
#include <IE.au3> 

WinWaitActive("http://www.cameraaction.local")

; Find the existing default printer.

$objWMIService = ObjGet("winmgmts:\\" & "localhost" & "\root\CIMV2")
$colPrinters = $objWMIService.ExecQuery _
("Select * From Win32_Printer Where Default = TRUE")
 For $objPrinter in $colPrinters
 $strPreDefault = $objPrinter.Name
 Next

; Set the default printer to the canon irc3200

$sPrinter = "\\server02\cainv"
_WinAPI_SetDefaultPrinter($sPrinter)
msgbox(1,"Set","Printer is set to \\server02\cainv")
sleep(3000)

; Send 8 Jobs to the Canon irc3200 printer

 Send("^p")
 sleep(2000)
 Send("{TAB 6}")
 sleep(2000)
 Send("8")
 sleep(2000)
 Send("{Enter}")
 sleep(10000)
; send("{ESC}")

; Send 4 jobs to QV HP3000N printer

$sPrinter2 = "\\server02\QV_HP3000N"
_WinAPI_SetDefaultPrinter($sPrinter2)
msgbox(1,"Set","Printer is set to \\server02\QV_HP3000N")
sleep(4000)

 Send("^p")
 sleep(2000)
 Send("{TAB 6}")
 sleep(2000)
 Send("4")
 sleep(2000)
 Send("{Enter}") 
 sleep(10000)
;send("{ESC}")

; Send 1 job to Paul & Sina's office

$sPrinter3 = "\\server02\PS_Office"
_WinAPI_SetDefaultPrinter($sPrinter3)
msgbox(1,"Set","Printer is set to \\server02\PS_Office")

sleep(4000)

 Send("^p")
 sleep(2000)
 Send("{TAB 6}")
 sleep(2000)
 Send("1")
 sleep(2000)
 Send("{Enter}") 
 sleep(10000)
; send("{ESC}")
 
; After all is printed reset to the user's original default printer.

_WinAPI_SetDefaultPrinter($strPreDefault)
Edited by petrosky

Share this post


Link to post
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
Sign in to follow this  
Followers 0