AntonioGNAL Posted September 27, 2011 Share Posted September 27, 2011 Hello everyone,I'm trying to build a script to create a new print queue for a specific software called SafeCom. But i found some problems, for example, the checkbox to auto detect printer sometimes is checked and sometimes is not. See image: http://img.photobucket.com/albums/v358/Daryon/AutoDetectPrinter_001.jpg Is there any way i can make sure it is not checked? I'm also finding in some servers the following, if someone has created a queue before, there are some selections already marked altering the reference of my pointer. I think what i'm trying to do is not possible, maybe i need to create the queue with cmd commands if that's an option. This is the script, not working fine atm. The sleep commands are just to see the first steps slowly. ; Start the Add Printer GUIRun("Rundll32 Printui.dll,PrintUIEntry /il"); Use AutoItSetOption to slow down the typing speed so we can see itAutoItSetOption("SendKeyDelay", 400)Sleep(3000); Click Next button - t Spanish n EnglishSend("{ENTER}")Sleep(3000); Select Local Print Queue and click NextSend("{UP}")Sleep(3000)Send("{ENTER}")Sleep(3000); Select the Create New Port optionSend("!C")Sleep(3000); Select The SafeCom PULL Port optionSend("{DOWN}")Sleep(3000); Click Next buttonSend("!t")Sleep(3000); Enter the new port name example: ESPULL01Send("ESPULL01"); Accept the new port nameSend("{ENTER}"); Navigate to the OK buttonSend("{TAB}")Send("{TAB}")Send("{ENTER}"); Send default passwordSend("nimda"); Click OKSend("{ENTER}"); Wait for the wizard to refreshSleep(10000); Browse for the print DriverSend("!U"); Delete the current path A:\Send("{BACKSPACE}")Send("{BACKSPACE}")Send("{BACKSPACE}"); Write the new path "C:\Archivos de programa\PrintDrivers\HP\UPD\53110527\WS2003x32\PCL5"Send("C:\Archivos de programa\PrintDrivers\HP\UPD\53110527\WS2003x32\PCL5"); Click BrowseSend("!m"); Select the FilesSend("{TAB}")Send("{TAB}")Send("{TAB}")Send("{TAB}")Send("{TAB}"); Scroll down the the correct .inf fileSend("{DOWN}"); Open the FileSend("!A"); Select AcceptSend("{TAB}")Send("{ENTER}"); Wait for the wizard to refreshSleep(10000); Select the HP UPD 5.3 PCL5 driverSend("{TAB}")Send("{TAB}")Send("{ENTER}"); Delete the current Printer Name "HP Universal Printing PCL 5 (v5.3)"For $i = 34 to 0 Step -1 Send("{BACKSPACE}")Next; Enter the new queue nameSend("ESPULL01"); Accept the new nameSend("{ENTER}"); Accept the same shared name and finishSend("!t")Send("!t")Send("!t")Send("{ENTER}"); Wait for the driver and printer queue to be installed$i=360Do $i = $i-1 ; check if the spooler process is still active. -1 indicates TRUE to quit the loop if (ProcessWait("spoolsv.exe",5) >0) Then $i = -1 Until ( $i <= 0); Finished! Thanks a lot. Best regards Link to comment Share on other sites More sharing options...
hannes08 Posted September 27, 2011 Share Posted September 27, 2011 Hi, take a look at:prndrvr.vbsprnmngr.vbsthese two scripts can install and manage printers. Maybe easier than automating a GUI. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
AntonioGNAL Posted September 27, 2011 Author Share Posted September 27, 2011 (edited) Thanks hannes08,I tried prnmngr.vbsbut i'm unable to make it work, i'm not sure if it can create new printer queues, maybe it is just to modify/connect existing ones. I tried a combination of the following: @echo offecho.echo Creating the new print queue ESPULL01cd C:\WINDOWS\System32cscript prncnfg.vbs -t -s localhost -p ESPULL01 -r ESPULL01 -m SafeComPULL -h ESPULL01 +Shared +published +queued -enablebidiecho Done!ping localhost -n 4 > nul Using the command: cscript prncnfg.vbs -t -s localhost -p ESPULL01 -r ESPULL01 -m SafeComPULL -h ESPULL01 I get this error: Unable to get the printer configuration ESPULL01 Error 0x80041002 Not foundOperation GetObjectProvider CIMWin32DescriptionWin32 Error code Can you help me with this? Thank a lot. Edited September 27, 2011 by AntonioGNAL Link to comment Share on other sites More sharing options...
AntonioGNAL Posted September 27, 2011 Author Share Posted September 27, 2011 (edited) New attempt, but there's something still missing, any help is really welcome: @echo off echo ======================================================================= echo PRINTER INSTALLATION echo ======================================================================= echo. echo. set /p _ip=Enter printer IP: cls echo ======================================================================= echo SELECT PRINTER TYPE ECHO ======================================================================= echo. echo 1. HP UPD PULL Queue. echo. echo x. Exit echo. set /p _sel=Enter number: if "%_sel%" == "1" call goto HPUPD if "%_sel%" == "x" call goto END exit :HPUPD cd c:\WINDOWS\System32 cscript Prndrvr.vbs -a -m "HP Universal Printing PCL 5 (v5.3)" -v 3 -e "Windows NT x86" -i "C:\Archivos de programa\PrintDrivers\HP\UPD\53110527\WS2003x32\PCL5\hpbuio20l.inf" pause cscript prnport.vbs -a -r IP_"%_ip%" -h "%_ip%" -o RAW -n 9100 pause cscript prnmngr.vbs -a -p "HPUPD" -m "HP Universal Printing PCL 5" -r IP_"%_ip%" pause cscript prnmngr.vbs -t -p "HPUPD" exit :END exit Edited September 27, 2011 by AntonioGNAL 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