;#RequireAdmin #Include "PrintMgr.au3" Local $PrinterName = "Print_test" Local $PrinterDriver = "HP Universal Printing PCL 6" Local $PrinterPath = "IP_192.168.0.1" Local $PrinterPort_IP = "192.168.0.1" ; Remove a printer called "My old Lexmark printer" : _PrintMgr_RemovePrinter($PrinterName) If @error Then MsgBox(0, "", "Ошибка удаления принтера", 5) Else MsgBox(4096, "INFO", "Принтер " & $PrinterName & " удалён", 5) EndIf ; Remove the driver called "Lexmark T640" : _PrintMgr_RemovePrinterDriver($PrinterDriver) If @error Then MsgBox(0, "", "Ошибка удаления драйвера", 5) Else MsgBox(4096, "INFO", "Драйвер " & $PrinterDriver & " удалён", 5) EndIf ; Remove the TCP/IP printer port called "TCP/IP" _PrintMgr_RemoveTCPIPPrinterPort($PrinterPath) If @error Then MsgBox(0, "", "Ошибка удаления порта", 5) Else MsgBox(4096, "INFO", "Порт " & $PrinterPort_IP & " удалён", 5) EndIf ; Add a driver, called "Samsung ML-451x 501x Series", and driver inf file is ".\Samsung5010\sse2m.inf" $OSArch = "Windows " & @OSArch _PrintMgr_AddPrinterDriver($PrinterDriver, $OSArch, @scriptDir & "\upd-pcl6", @scriptDir & "\upd-pcl6\hpcu196u.inf") If @error Then MsgBox(0, "", "Ошибка добавления драйвера", 5) Else MsgBox(4096, "INFO", "Путь для установки драйвера установен", 5) EndIf ; Add a TCP/IP printer port, called "MyTCPIPPrinterPort", with IPAddress = 192.168.1.10 and Port = 9100 _PrintMgr_AddTCPIPPrinterPort($PrinterPath, $PrinterPort_IP, 9100) If @error Then MsgBox(0, "", "Ошибка добавления порта", 5) Else MsgBox(4096, "INFO", "Порт добавлен", 5) EndIf ; Add a printer, give it the name "My Printer", use the driver called "Samsung ML-451x 501x Series" and the port called "MyTCPIPPrinterPort" _PrintMgr_AddPrinter($PrinterName, $PrinterDriver, $PrinterPath) If @error Then MsgBox(0, "", "Ошибка добавления принтера", 5) Else MsgBox(4096, "INFO", "Принтер " & $PrinterName & " установен", 5) EndIf ; Set the printer called "My Printer" as default printer _PrintMgr_SetDefaultPrinter($PrinterName) If @error Then MsgBox(0, "", "Ошибка установкки принтера по умолчанию", 5) Else MsgBox(4096, "INFO", "Принтер " & $PrinterName & " включён по умолчанию", 5) EndIf #cs ; Connect to the shared printer "\\192.168.1.1\HPDeskjetColor") ;;;;_PrintMgr_AddWindowsPrinterConnection("\\192.168.1.1\HPDeskjetColor") ; List all installed printers #Include $aPrinterList = _PrintMgr_EnumPrinter() _ArrayDisplay($aPrinterList) ; List all printers configuration ;#Include $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration() _ArrayDisplay($aPrinterConfig) ; List all installed printer drivers #Include $aDriverList = _EnumPrinterDriver() _ArrayDisplay($aDriverList) ; Retrieve the printer configuration for the printer called "Lexmark T640" #Include $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration($PrinterName) _ArrayDisplay($aPrinterConfig) ; Add a local printer port (for a file output) _AddLocalPrinterPort("c:\temp\output.pcl") ; Remove the local port _RemoveLocalPrinterPort("c:\temp\output.pcl") #ce