petrosky Posted May 9, 2008 Share Posted May 9, 2008 (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. expandcollapse popup#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 May 9, 2008 by petrosky Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now