Jump to content

Recommended Posts

Posted

Hi Everybody

Sorry by advance for my bad english.

Is there an autoit script who can convert batch script (.bat) in autoit script ?

I need to convert 3 batch files to just 1 autoit script.

But i dont want to use the _Rundos command

Thanks for response.

Posted

lafafmentvotre,

Looks like you have a mix of several important aspects of AutoIt in there...

  • For.. Next.. Loop
  • If Then EndIf
  • Run/ShellExecute
Take a look those and see if you can attempt to convert it.

Note: You wont need to convert REM, just use the comment character ; also :SETFLAGVER for example is the equivalent of Func..EndFunc

James

Posted

I know there are a mix of autoit commands.

I begin this but it's complex to write the same batchh script in autoit

I have problem with $avArray[$i][3]

help please

#cs ----------------------------------------------------------------------------
AutoIT:     3.3.6.0
Author:     Infrastructure@2010
Function:   Install Regus Printers
#ce ----------------------------------------------------------------------------
Break(1)
;########################################################################################
;################################ AUTOIT VARIABLES ######################################
;########################################################################################
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <EditConstants.au3>
#include <Array.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <ProgressConstants.au3>
;########################################################################################
;############################### DIRECTORY & DRIVERS ####################################
;########################################################################################
DirCreate(@Tempdir&"\Sources_Regus")
DirCreate(@Tempdir&"\Sources_Regus\Drivers")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\WinXP")

FileInstall("\Sources_Regus\Regus-Printers.txt", @Tempdir&"\Sources_Regus\Regus-Printers.txt", 1)
FileInstall("\Sources_Regus\Drivers\hpfxgen.sys", @Tempdir&"\Sources_Regus\Drivers\hpfxgen.sys", 1)
FileInstall("\Sources_Regus\Drivers\hpfxbulk.sys", @Tempdir&"\Sources_Regus\Drivers\hpfxbulk.sys", 1)
FileInstall("\Sources_Regus\Drivers\hppcbulkio.sys", @Tempdir&"\Sources_Regus\Drivers\hppcbulkio.sys", 1)
FileInstall("\Sources_Regus\Drivers\hppcgenio.sys", @Tempdir&"\Sources_Regus\Drivers\hppcgenio.sys", 1)
FileInstall("\Sources_Regus\Drivers\hpzius13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzius13.inf", 1)
FileInstall("\Sources_Regus\Drivers\hpzipa13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzipa13.inf", 1)
FileInstall("\Sources_Regus\Drivers\hppscnd.inf", @Tempdir&"\Sources_Regus\Drivers\hppscnd.inf", 1)
FileInstall("\Sources_Regus\Drivers\hpzist13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzist13.inf", 1)
FileInstall("\Sources_Regus\Drivers\hppfaxnd.inf", @Tempdir&"\Sources_Regus\Drivers\hppfaxnd.inf", 1)
FileInstall("\Sources_Regus\Drivers\hpmews01.inf", @Tempdir&"\Sources_Regus\Drivers\hpmews01.inf", 1)
FileInstall("\Sources_Regus\Drivers\hppewnd.inf", @Tempdir&"\Sources_Regus\Drivers\hppewnd.inf", 1)
FileInstall("\Sources_Regus\Drivers\hpzid413.inf", @Tempdir&"\Sources_Regus\Drivers\hpzid413.inf", 1)
FileInstall("\Sources_Regus\Drivers\hpmldm01.inf", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.inf", 1)
FileInstall("\Sources_Regus\Drivers\hpzipr13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzipr13.inf", 1)
FileInstall("\Sources_Regus\Drivers\hpzid4vp.inf", @Tempdir&"\Sources_Regus\Drivers\hpzid4vp.inf", 1)
FileInstall("\Sources_Regus\Drivers\hpcu083b.inf", @Tempdir&"\Sources_Regus\Drivers\hpcu083b.inf", 1)
FileInstall("\Sources_Regus\Drivers\install.exe", @Tempdir&"\Sources_Regus\Drivers\install.exe", 1)
FileInstall("\Sources_Regus\Drivers\hpmews01.dll", @Tempdir&"\Sources_Regus\Drivers\hpmews01.dll", 1)
FileInstall("\Sources_Regus\Drivers\Hpzc3212.dll", @Tempdir&"\Sources_Regus\Drivers\Hpzc3212.dll", 1)
FileInstall("\Sources_Regus\Drivers\hpbcfgre.dll", @Tempdir&"\Sources_Regus\Drivers\hpbcfgre.dll", 1)
FileInstall("\Sources_Regus\Drivers\hpmprein.dll", @Tempdir&"\Sources_Regus\Drivers\hpmprein.dll", 1)
FileInstall("\Sources_Regus\Drivers\hpmldm01.dll", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.dll", 1)
FileInstall("\Sources_Regus\Drivers\hpmco083.dll", @Tempdir&"\Sources_Regus\Drivers\hpmco083.dll", 1)
FileInstall("\Sources_Regus\Drivers\Install.dll", @Tempdir&"\Sources_Regus\Drivers\Install.dll", 1)
FileInstall("\Sources_Regus\Drivers\hpmews01.dat", @Tempdir&"\Sources_Regus\Drivers\hpmews01.dat", 1)
FileInstall("\Sources_Regus\Drivers\hpmldm01.dat", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.dat", 1)
FileInstall("\Sources_Regus\Drivers\hpmprein.config", @Tempdir&"\Sources_Regus\Drivers\hpmprein.config", 1)
FileInstall("\Sources_Regus\Drivers\hppldcoi.config", @Tempdir&"\Sources_Regus\Drivers\hppldcoi.config", 1)
FileInstall("\Sources_Regus\Drivers\RemoveHPPrinterConnection.cmd", @Tempdir&"\Sources_Regus\Drivers\RemoveHPPrinterConnection.cmd", 1)
FileInstall("\Sources_Regus\Drivers\install.cmd", @Tempdir&"\Sources_Regus\Drivers\install.cmd", 1)
FileInstall("\Sources_Regus\Drivers\hpcpu083.cf_", @Tempdir&"\Sources_Regus\Drivers\hpcpu083.cf_", 1)
FileInstall("\Sources_Regus\Drivers\hppewnd.cat", @Tempdir&"\Sources_Regus\Drivers\hppewnd.cat", 1)
FileInstall("\Sources_Regus\Drivers\hppfaxnd.cat", @Tempdir&"\Sources_Regus\Drivers\hppfaxnd.cat", 1)
FileInstall("\Sources_Regus\Drivers\hppscnd.cat", @Tempdir&"\Sources_Regus\Drivers\hppscnd.cat", 1)
FileInstall("\Sources_Regus\Drivers\hpzid4vp.cat", @Tempdir&"\Sources_Regus\Drivers\hpzid4vp.cat", 1)
FileInstall("\Sources_Regus\Drivers\hpzid413.cat", @Tempdir&"\Sources_Regus\Drivers\hpzid413.cat", 1)
FileInstall("\Sources_Regus\Drivers\hpzipa13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzipa13.cat", 1)
FileInstall("\Sources_Regus\Drivers\hpzius13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzius13.cat", 1)
FileInstall("\Sources_Regus\Drivers\hpzipr13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzipr13.cat", 1)
FileInstall("\Sources_Regus\Drivers\hpzist13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzist13.cat", 1)
FileInstall("\Sources_Regus\Drivers\hpmldm01.cat", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.cat", 1)
FileInstall("\Sources_Regus\Drivers\hpmews01.cat", @Tempdir&"\Sources_Regus\Drivers\hpmews01.cat", 1)
FileInstall("\Sources_Regus\Drivers\hpcu083b.cat", @Tempdir&"\Sources_Regus\Drivers\hpcu083b.cat", 1)
FileInstall("\Sources_Regus\Drivers\p5i2daww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2daww.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2ptww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2ptww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2ruww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2ruww.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2deww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2deww.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2zhtw.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2zhtw.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2itww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2itww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2heww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2heww.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2esww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2esww.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2koww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2koww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2plww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2plww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2csww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2csww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2nlww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2nlww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2etww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2etww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2srww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2srww.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2frww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2frww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2slww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2slww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2ukww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2ukww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2skww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2skww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2idww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2idww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2caww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2caww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2arww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2arww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2ltww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2ltww.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2jaww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2jaww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2hrww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2hrww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2roww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2roww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2elww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2elww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2lvww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2lvww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2thww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2thww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2viww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2viww.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2enww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2enww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2fiww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2fiww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2huww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2huww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2trww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2trww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2kkww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2kkww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2svww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2svww.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2bgww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2bgww.cab", 1)
FileInstall("\Sources_Regus\Drivers\P5i2zhcn.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2zhcn.cab", 1)
FileInstall("\Sources_Regus\Drivers\p5i2noww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2noww.cab", 1)
FileInstall("\Sources_Regus\Drivers\hpcu083b.cab", @Tempdir&"\Sources_Regus\Drivers\hpcu083b.cab", 1)
FileInstall("\Sources_Regus\Drivers\hpmup083.bin", @Tempdir&"\Sources_Regus\Drivers\hpmup083.bin", 1)

FileInstall("\Sources_Regus\Drivers\Drivers\Dot4\Win2000\difxapi.dll", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\difxapi.dll", 1)
FileInstall("\Sources_Regus\Drivers\Drivers\Dot4\Win2000\hppldcoi.dll", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\hppldcoi.dll", 1)
FileInstall("\Sources_Regus\Drivers\Drivers\Dot4\Win2000\Hpzc3212.dll", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\Hpzc3212.dll", 1)
FileInstall("\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZid412.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZid412.sys", 1)
FileInstall("\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZipr12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZipr12.sys", 1)
FileInstall("\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZisc12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZisc12.sys", 1)
FileInstall("\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZius12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZius12.sys", 1)
FileInstall("\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZs2k12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZs2k12.sys", 1)

FileInstall("\Sources_Regus\Drivers\Drivers\Dot4\WinXP\hppaufd0.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\WinXP\hppaufd0.sys", 1)
;########################################################################################
;################################ SCRIPT VARIABLES ######################################
;########################################################################################
Local $local_ini_ver,$remote_ini_ver,$same
$printerflag=@WindowsDir&"\Printers1.flg"
$BtqCode=StringLeft(@ComputerName, 3)
$local_ini=@WindowsDir&"\REG-LPrinters.ini"
$remote_ini="\Sources_Regus\REG-LPrinters.ini"

;########################################################################################
;#################################### GOCPRINTERS #######################################
;########################################################################################
CompareFlagVersion()
Select
Case $local_ini_ver = $remote_ini_ver
Exit
Case Else

$debut_registre = "HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\"
$i=1
While 1
$nb=RegEnumKey($debut_registre, $i)
$reg=RegRead ($debut_registre&$nb&"\", "IPAddress")
Local $avArray[$i][3]
;in progress....

If $reg <> "" Then

$remote_ini_ip=IniRead($remote_ini,"PRINTER01","Ip","")
$remote_ini_name=IniRead($remote_ini,"PRINTER01","Name","")
$remote_ini_location=IniRead($remote_ini,"PRINTER01","Location","")
EndIf
WEnd
EndSelect

Func CompareFlagVersion()
$local_ini_ver=IniRead($local_ini,"FLAG","Version","")
$remote_ini_ver=IniRead($remote_ini,"FLAG","Version","")
If $local_ini_ver <> $remote_ini_ver Then
Return $same
Else
Exit
EndIf
EndFunc
Posted (edited)

I have problem with $avArray[$i][3]

help please

$i=1
While 1
$nb=RegEnumKey($debut_registre, $i)
$reg=RegRead ($debut_registre&$nb&"\", "IPAddress")
Local $avArray[$i][3]
;in progress....
WEnd

Shows sample for you;

Dim $avArray[50][3] = [ [ 0 ] ]

$i=1
While 1
    $nb=RegEnumKey($debut_registre, $i)

    $avArray[0][0] += 1
    $avArray[$avArray[0][0]][0] =  RegRead ($debut_registre&$nb&"\", "IPAddress")
    $avArray[$avArray[0][0]][1] =  RegRead ($debut_registre&$nb&"\", "Name")
    $avArray[$avArray[0][0]][2] =  RegRead ($debut_registre&$nb&"\", "Time")
WEnd

ReDim $avArray[$avArray[0][0]][3]
Edited by DllParse
Posted

Hello DllParse

There is an error in line 187 :

$avArray[$avArray[0][0]][0] =  RegRead ($debut_registre&$nb&"\", "IPAddress")

The error :

D:\Backup_DD_Externe\AutoIt Development\HP_PCL5\Regus_Printers.au3 (187) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$avArray[$avArray[0][0]][0] =  RegRead ($debut_registre&$nb&"\", "IPAddress")
^ ERROR

Thanks for help

Posted

Hi everybody

The batch scripts works fine for computers who haven't printers but if printers exist, the script do nothing.

I need the same in autoit script who check if printers are installed, verify installed printers and compare with "REG_Printers.ini".

If a new printer exist in "REG_Printers.ini", the script install this new printer on computer.

If a printer doesn't exist in "REG_Printers.ini", the script uninstall printer on computer.

Who can help me for this ?

Thanks by advance

Posted (edited)

Hi everybody

I made this in autoit for my solution but there is an error when the script run these commands (line 143-146):

_RunDOS('"rundll32 printui.dll,PrintUIEntry /if /f "'&$inf&'" /u /b "'&$name&'" /r "IP_'&$ip&'" /m "HP Universal Printing PCL 5""')
_RunDOS('"rundll32 printui.dll,PrintUIEntry /q /Xs /n "'&$name&'" Comment "'&$location&'""')
_RunDOS('"rundll32 printui.dll,PrintUIEntry /q /Xs /n "'&$name&'" Location "'&$location&'""')

The message is (in french because i am on XP FR) :

Posted Image

Who can help me please

Thanks

The actual script :

#cs ----------------------------------------------------------------------------
AutoIT:     3.3.6.0
Author:     Infrastructure@2010
Function:   Install Regus Printers
#ce ----------------------------------------------------------------------------
Break(1)
#region AUTOIT VARIABLES
#include <Array.au3>
#include <Process.au3>
#endregion
#region SCRIPT VARIABLES
Local $avArray
#endregion
#region DIRECTORY & DRIVERS
DirCreate(@Tempdir&"\Sources_Regus")
DirCreate(@Tempdir&"\Sources_Regus\Drivers")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\WinXP")

FileInstall("Sources_Regus\printers.inf", @Tempdir&"\Sources_Regus\printers.inf", 1)
FileInstall("Sources_Regus\Drivers\hpfxgen.sys", @Tempdir&"\Sources_Regus\Drivers\hpfxgen.sys", 1)
FileInstall("Sources_Regus\Drivers\hpfxbulk.sys", @Tempdir&"\Sources_Regus\Drivers\hpfxbulk.sys", 1)
FileInstall("Sources_Regus\Drivers\hppcbulkio.sys", @Tempdir&"\Sources_Regus\Drivers\hppcbulkio.sys", 1)
FileInstall("Sources_Regus\Drivers\hppcgenio.sys", @Tempdir&"\Sources_Regus\Drivers\hppcgenio.sys", 1)
FileInstall("Sources_Regus\Drivers\hpzius13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzius13.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzipa13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzipa13.inf", 1)
FileInstall("Sources_Regus\Drivers\hppscnd.inf", @Tempdir&"\Sources_Regus\Drivers\hppscnd.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzist13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzist13.inf", 1)
FileInstall("Sources_Regus\Drivers\hppfaxnd.inf", @Tempdir&"\Sources_Regus\Drivers\hppfaxnd.inf", 1)
FileInstall("Sources_Regus\Drivers\hpmews01.inf", @Tempdir&"\Sources_Regus\Drivers\hpmews01.inf", 1)
FileInstall("Sources_Regus\Drivers\hppewnd.inf", @Tempdir&"\Sources_Regus\Drivers\hppewnd.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzid413.inf", @Tempdir&"\Sources_Regus\Drivers\hpzid413.inf", 1)
FileInstall("Sources_Regus\Drivers\hpmldm01.inf", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzipr13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzipr13.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzid4vp.inf", @Tempdir&"\Sources_Regus\Drivers\hpzid4vp.inf", 1)
FileInstall("Sources_Regus\Drivers\hpcu083b.inf", @Tempdir&"\Sources_Regus\Drivers\hpcu083b.inf", 1)
FileInstall("Sources_Regus\Drivers\install.exe", @Tempdir&"\Sources_Regus\Drivers\install.exe", 1)
FileInstall("Sources_Regus\Drivers\hpmews01.dll", @Tempdir&"\Sources_Regus\Drivers\hpmews01.dll", 1)
FileInstall("Sources_Regus\Drivers\Hpzc3212.dll", @Tempdir&"\Sources_Regus\Drivers\Hpzc3212.dll", 1)
FileInstall("Sources_Regus\Drivers\hpbcfgre.dll", @Tempdir&"\Sources_Regus\Drivers\hpbcfgre.dll", 1)
FileInstall("Sources_Regus\Drivers\hpmprein.dll", @Tempdir&"\Sources_Regus\Drivers\hpmprein.dll", 1)
FileInstall("Sources_Regus\Drivers\hpmldm01.dll", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.dll", 1)
FileInstall("Sources_Regus\Drivers\hpmco083.dll", @Tempdir&"\Sources_Regus\Drivers\hpmco083.dll", 1)
FileInstall("Sources_Regus\Drivers\Install.dll", @Tempdir&"\Sources_Regus\Drivers\Install.dll", 1)
FileInstall("Sources_Regus\Drivers\hpmews01.dat", @Tempdir&"\Sources_Regus\Drivers\hpmews01.dat", 1)
FileInstall("Sources_Regus\Drivers\hpmldm01.dat", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.dat", 1)
FileInstall("Sources_Regus\Drivers\hpmprein.config", @Tempdir&"\Sources_Regus\Drivers\hpmprein.config", 1)
FileInstall("Sources_Regus\Drivers\hppldcoi.config", @Tempdir&"\Sources_Regus\Drivers\hppldcoi.config", 1)
FileInstall("Sources_Regus\Drivers\RemoveHPPrinterConnection.cmd", @Tempdir&"\Sources_Regus\Drivers\RemoveHPPrinterConnection.cmd", 1)
FileInstall("Sources_Regus\Drivers\install.cmd", @Tempdir&"\Sources_Regus\Drivers\install.cmd", 1)
FileInstall("Sources_Regus\Drivers\hpcpu083.cf_", @Tempdir&"\Sources_Regus\Drivers\hpcpu083.cf_", 1)
FileInstall("Sources_Regus\Drivers\hppewnd.cat", @Tempdir&"\Sources_Regus\Drivers\hppewnd.cat", 1)
FileInstall("Sources_Regus\Drivers\hppfaxnd.cat", @Tempdir&"\Sources_Regus\Drivers\hppfaxnd.cat", 1)
FileInstall("Sources_Regus\Drivers\hppscnd.cat", @Tempdir&"\Sources_Regus\Drivers\hppscnd.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzid4vp.cat", @Tempdir&"\Sources_Regus\Drivers\hpzid4vp.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzid413.cat", @Tempdir&"\Sources_Regus\Drivers\hpzid413.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzipa13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzipa13.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzius13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzius13.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzipr13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzipr13.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzist13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzist13.cat", 1)
FileInstall("Sources_Regus\Drivers\hpmldm01.cat", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.cat", 1)
FileInstall("Sources_Regus\Drivers\hpmews01.cat", @Tempdir&"\Sources_Regus\Drivers\hpmews01.cat", 1)
FileInstall("Sources_Regus\Drivers\hpcu083b.cat", @Tempdir&"\Sources_Regus\Drivers\hpcu083b.cat", 1)
FileInstall("Sources_Regus\Drivers\p5i2daww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2daww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2ptww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2ptww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2ruww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2ruww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2deww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2deww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2zhtw.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2zhtw.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2itww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2itww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2heww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2heww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2esww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2esww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2koww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2koww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2plww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2plww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2csww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2csww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2nlww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2nlww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2etww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2etww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2srww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2srww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2frww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2frww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2slww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2slww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2ukww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2ukww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2skww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2skww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2idww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2idww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2caww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2caww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2arww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2arww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2ltww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2ltww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2jaww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2jaww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2hrww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2hrww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2roww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2roww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2elww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2elww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2lvww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2lvww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2thww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2thww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2viww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2viww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2enww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2enww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2fiww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2fiww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2huww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2huww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2trww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2trww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2kkww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2kkww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2svww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2svww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2bgww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2bgww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2zhcn.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2zhcn.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2noww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2noww.cab", 1)
FileInstall("Sources_Regus\Drivers\hpcu083b.cab", @Tempdir&"\Sources_Regus\Drivers\hpcu083b.cab", 1)
FileInstall("Sources_Regus\Drivers\hpmup083.bin", @Tempdir&"\Sources_Regus\Drivers\hpmup083.bin", 1)

FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\difxapi.dll", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\difxapi.dll", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\hppldcoi.dll", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\hppldcoi.dll", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\Hpzc3212.dll", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\Hpzc3212.dll", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZid412.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZid412.sys", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZipr12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZipr12.sys", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZisc12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZisc12.sys", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZius12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZius12.sys", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZs2k12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZs2k12.sys", 1)

FileInstall("Sources_Regus\Drivers\Drivers\Dot4\WinXP\hppaufd0.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\WinXP\hppaufd0.sys", 1)
#endregion
#region SCRIPT
$i=1
$file=FileOpen(@Tempdir&"\Sources_Regus\printers.inf", 0)
$inf=@Tempdir&"\Sources_Regus\Drivers\hpcu083b.inf"
For $i=1 To 8
$avArray=StringSplit(FileReadLine($file,$i),",")
If @error = -1 Then ExitLoop
$ip=_ArrayToString($avArray, @TAB, 1, 1)
$name=_ArrayToString($avArray, @TAB, 2, 2)
$location=_ArrayToString($avArray, @TAB, 3, 3)
$m1 = "Installation "&$name&" en cours."
SplashTextOn("Update", $m1, 300, 40, -1, -1, 1, "", 8, 400)
_ArrayDisplay($avArray, "Vitesse Carte reseau")
If Not RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"IPAddress") Then
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"Hostname","REG_SZ","")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"HWAddress","REG_SZ","")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"IPAddress","REG_SZ",$ip)
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"PortNumber","REG_DWORD","9100")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"Protocol","REG_DWORD","00000001")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"SNMP Community","REG_SZ","public")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"SNMP Enabled","REG_DWORD","00000000")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"SNMP Index","REG_DWORD","00000001")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"Version","REG_DWORD","00000001")
EndIf
If Not RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\"&$name,"Name") Then
_RunDOS('"rundll32 printui.dll,PrintUIEntry /if /f "'&$inf&'" /u /b "'&$name&'" /r "IP_'&$ip&'" /m "HP Universal Printing PCL 5""')
_RunDOS('"rundll32 printui.dll,PrintUIEntry /q /Xs /n "'&$name&'" Comment "'&$location&'""')
_RunDOS('"rundll32 printui.dll,PrintUIEntry /q /Xs /n "'&$name&'" Location "'&$location&'""')
EndIf
Next
FileClose($file)
SplashOff()
endmsg()
#endregion
#region FUNCTIONS
Func endmsg()
$m2 = "Installation terminée"
MsgBox(0, "RICHEMONT INFORMATIQUE", $m2)
DirRemove(@Tempdir&"\Sources_Regus",1)
Exit
EndFunc
#endregion
Edited by lafafmentvotre
Posted

Hi MvGulik, hello the forum

This is the input data in the msgbox :

"rundll32 printui.dll,PrintUIEntry /if /f "C:\DOCUME~1\FABIEN~1.SER\LOCALS~1\Temp\Sources_Regus\Drivers\hpcu083b.inf" /u /b "FRREGUP000005" /r "IP_10.189.11.35" /m "HP Universal Printing PCL 5""

When i use this line in Start\Run (without the first and last "), i have the same error :

Posted Image

Posted

It works but just for the first printer.

The others don't works, i have the same error.

I don't understand because my array works with good informations for variable (informations ara in printers.inf)

First Array :

Posted Image

Second Array :

Posted Image

Argggghhhhhhhh !!!!!!!

Posted

Eureka

I found the problem to install printers.

The script need to stop and start the Spooler Service before "Next" :

If Not RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\"&$name, "Name") Then
GUICtrlSetData($label2,"Installation "&$name&" en cours...")
_RunDOS("rundll32 printui.dll,PrintUIEntry /if /f """&$inf&""" /u /b """&$name&""" /r ""IP_"&$ip&""" /m ""HP Universal Printing PCL 5""")
_RunDOS('"rundll32 printui.dll,PrintUIEntry /q /Xs /n "'&$name&'" Comment "'&$location&'""')
_RunDOS('"rundll32 printui.dll,PrintUIEntry /q /Xs /n "'&$name&'" Location "'&$location&'""')
GUICtrlSetData($label2,"Relance Spooler en cours...")
_RunDOS('net stop "'&$sServiceName&'"')
_RunDOS('net start "'&$sServiceName&'"')
EndIf

Next step, help is needed, is to delete printers who not include in printers.inf (i have the script to uninstall all include in printers.inf)

Thanks all for help

This the final script

#cs ----------------------------------------------------------------------------
AutoIT:     3.3.6.0
Author:     Infrastructure@2010
Function:   Install Regus Printers
#ce ----------------------------------------------------------------------------
Break(1)
#region AUTOIT VARIABLES
#include <Array.au3>
#include <Process.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#endregion
#region SCRIPT VARIABLES
Local $avArray
Local $file=FileOpen(@Tempdir&"\Sources_Regus\printers.inf", 0)
Local $inf=@Tempdir&"\Sources_Regus\Drivers\hpcu083b.inf"
Local $sServiceName="Spooler"
#endregion
#region DIRECTORY & DRIVERS
DirCreate(@Tempdir&"\Sources_Regus")
DirCreate(@Tempdir&"\Sources_Regus\Drivers")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000")
DirCreate(@Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\WinXP")

FileInstall("Sources_Regus\printers.inf", @Tempdir&"\Sources_Regus\printers.inf", 1)
FileInstall("Sources_Regus\Drivers\hpfxgen.sys", @Tempdir&"\Sources_Regus\Drivers\hpfxgen.sys", 1)
FileInstall("Sources_Regus\Drivers\hpfxbulk.sys", @Tempdir&"\Sources_Regus\Drivers\hpfxbulk.sys", 1)
FileInstall("Sources_Regus\Drivers\hppcbulkio.sys", @Tempdir&"\Sources_Regus\Drivers\hppcbulkio.sys", 1)
FileInstall("Sources_Regus\Drivers\hppcgenio.sys", @Tempdir&"\Sources_Regus\Drivers\hppcgenio.sys", 1)
FileInstall("Sources_Regus\Drivers\hpzius13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzius13.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzipa13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzipa13.inf", 1)
FileInstall("Sources_Regus\Drivers\hppscnd.inf", @Tempdir&"\Sources_Regus\Drivers\hppscnd.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzist13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzist13.inf", 1)
FileInstall("Sources_Regus\Drivers\hppfaxnd.inf", @Tempdir&"\Sources_Regus\Drivers\hppfaxnd.inf", 1)
FileInstall("Sources_Regus\Drivers\hpmews01.inf", @Tempdir&"\Sources_Regus\Drivers\hpmews01.inf", 1)
FileInstall("Sources_Regus\Drivers\hppewnd.inf", @Tempdir&"\Sources_Regus\Drivers\hppewnd.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzid413.inf", @Tempdir&"\Sources_Regus\Drivers\hpzid413.inf", 1)
FileInstall("Sources_Regus\Drivers\hpmldm01.inf", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzipr13.inf", @Tempdir&"\Sources_Regus\Drivers\hpzipr13.inf", 1)
FileInstall("Sources_Regus\Drivers\hpzid4vp.inf", @Tempdir&"\Sources_Regus\Drivers\hpzid4vp.inf", 1)
FileInstall("Sources_Regus\Drivers\hpcu083b.inf", @Tempdir&"\Sources_Regus\Drivers\hpcu083b.inf", 1)
FileInstall("Sources_Regus\Drivers\install.exe", @Tempdir&"\Sources_Regus\Drivers\install.exe", 1)
FileInstall("Sources_Regus\Drivers\hpmews01.dll", @Tempdir&"\Sources_Regus\Drivers\hpmews01.dll", 1)
FileInstall("Sources_Regus\Drivers\Hpzc3212.dll", @Tempdir&"\Sources_Regus\Drivers\Hpzc3212.dll", 1)
FileInstall("Sources_Regus\Drivers\hpbcfgre.dll", @Tempdir&"\Sources_Regus\Drivers\hpbcfgre.dll", 1)
FileInstall("Sources_Regus\Drivers\hpmprein.dll", @Tempdir&"\Sources_Regus\Drivers\hpmprein.dll", 1)
FileInstall("Sources_Regus\Drivers\hpmldm01.dll", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.dll", 1)
FileInstall("Sources_Regus\Drivers\hpmco083.dll", @Tempdir&"\Sources_Regus\Drivers\hpmco083.dll", 1)
FileInstall("Sources_Regus\Drivers\Install.dll", @Tempdir&"\Sources_Regus\Drivers\Install.dll", 1)
FileInstall("Sources_Regus\Drivers\hpmews01.dat", @Tempdir&"\Sources_Regus\Drivers\hpmews01.dat", 1)
FileInstall("Sources_Regus\Drivers\hpmldm01.dat", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.dat", 1)
FileInstall("Sources_Regus\Drivers\hpmprein.config", @Tempdir&"\Sources_Regus\Drivers\hpmprein.config", 1)
FileInstall("Sources_Regus\Drivers\hppldcoi.config", @Tempdir&"\Sources_Regus\Drivers\hppldcoi.config", 1)
FileInstall("Sources_Regus\Drivers\RemoveHPPrinterConnection.cmd", @Tempdir&"\Sources_Regus\Drivers\RemoveHPPrinterConnection.cmd", 1)
FileInstall("Sources_Regus\Drivers\install.cmd", @Tempdir&"\Sources_Regus\Drivers\install.cmd", 1)
FileInstall("Sources_Regus\Drivers\hpcpu083.cf_", @Tempdir&"\Sources_Regus\Drivers\hpcpu083.cf_", 1)
FileInstall("Sources_Regus\Drivers\hppewnd.cat", @Tempdir&"\Sources_Regus\Drivers\hppewnd.cat", 1)
FileInstall("Sources_Regus\Drivers\hppfaxnd.cat", @Tempdir&"\Sources_Regus\Drivers\hppfaxnd.cat", 1)
FileInstall("Sources_Regus\Drivers\hppscnd.cat", @Tempdir&"\Sources_Regus\Drivers\hppscnd.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzid4vp.cat", @Tempdir&"\Sources_Regus\Drivers\hpzid4vp.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzid413.cat", @Tempdir&"\Sources_Regus\Drivers\hpzid413.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzipa13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzipa13.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzius13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzius13.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzipr13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzipr13.cat", 1)
FileInstall("Sources_Regus\Drivers\hpzist13.cat", @Tempdir&"\Sources_Regus\Drivers\hpzist13.cat", 1)
FileInstall("Sources_Regus\Drivers\hpmldm01.cat", @Tempdir&"\Sources_Regus\Drivers\hpmldm01.cat", 1)
FileInstall("Sources_Regus\Drivers\hpmews01.cat", @Tempdir&"\Sources_Regus\Drivers\hpmews01.cat", 1)
FileInstall("Sources_Regus\Drivers\hpcu083b.cat", @Tempdir&"\Sources_Regus\Drivers\hpcu083b.cat", 1)
FileInstall("Sources_Regus\Drivers\p5i2daww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2daww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2ptww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2ptww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2ruww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2ruww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2deww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2deww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2zhtw.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2zhtw.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2itww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2itww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2heww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2heww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2esww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2esww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2koww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2koww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2plww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2plww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2csww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2csww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2nlww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2nlww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2etww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2etww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2srww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2srww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2frww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2frww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2slww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2slww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2ukww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2ukww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2skww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2skww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2idww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2idww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2caww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2caww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2arww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2arww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2ltww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2ltww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2jaww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2jaww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2hrww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2hrww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2roww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2roww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2elww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2elww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2lvww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2lvww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2thww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2thww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2viww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2viww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2enww.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2enww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2fiww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2fiww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2huww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2huww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2trww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2trww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2kkww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2kkww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2svww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2svww.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2bgww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2bgww.cab", 1)
FileInstall("Sources_Regus\Drivers\P5i2zhcn.cab", @Tempdir&"\Sources_Regus\Drivers\P5i2zhcn.cab", 1)
FileInstall("Sources_Regus\Drivers\p5i2noww.cab", @Tempdir&"\Sources_Regus\Drivers\p5i2noww.cab", 1)
FileInstall("Sources_Regus\Drivers\hpcu083b.cab", @Tempdir&"\Sources_Regus\Drivers\hpcu083b.cab", 1)
FileInstall("Sources_Regus\Drivers\hpmup083.bin", @Tempdir&"\Sources_Regus\Drivers\hpmup083.bin", 1)

FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\difxapi.dll", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\difxapi.dll", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\hppldcoi.dll", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\hppldcoi.dll", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\Hpzc3212.dll", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\Hpzc3212.dll", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZid412.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZid412.sys", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZipr12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZipr12.sys", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZisc12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZisc12.sys", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZius12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZius12.sys", 1)
FileInstall("Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZs2k12.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\Win2000\HPZs2k12.sys", 1)

FileInstall("Sources_Regus\Drivers\Drivers\Dot4\WinXP\hppaufd0.sys", @Tempdir&"\Sources_Regus\Drivers\Drivers\Dot4\WinXP\hppaufd0.sys", 1)
#endregion
#region GUI
$gui=GuiCreate("", 300, 80, -1, -1, $WS_POPUPWINDOW)
$label1=GUICtrlCreateLabel(""&StringTrimRight(StringUpper(@ScriptName),4), 0, 10, 286, 17, $SS_CENTER)
GUICtrlSetFont(-1, 9, 800)
$label2=GUICtrlCreateLabel("Vérification en cours...", 1, 36, 286, 17,$SS_CENTER)
GUISetState(@SW_SHOW,$gui)
#endregion
#region SCRIPT
$i=1
For $i=1 To 8
$avArray=StringSplit(FileReadLine($file,$i),",")
If @error = -1 Then ExitLoop
$ip=_ArrayToString($avArray, @TAB, 1, 1)
$name=_ArrayToString($avArray, @TAB, 2, 2)
$location=_ArrayToString($avArray, @TAB, 3, 3)
;Install Driver
If Not RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\HP Universal Printing PCL 5","Driver") Then
GUICtrlSetData($label2,"Installation drivers en cours...")
_RunDOS('"rundll32 printui.dll,PrintUIEntry /ia /m "HP Universal Printing PCL 5" /f "'&$inf&'""')
;~ SplashOff()
EndIf
If Not RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"IPAddress") Then
GUICtrlSetData($label2,"Installation port IP_"&$ip&" en cours...")
Sleep(4000)
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"Hostname","REG_SZ","")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"HWAddress","REG_SZ","")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"IPAddress","REG_SZ",$ip)
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"PortNumber","REG_DWORD","9100")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"Protocol","REG_DWORD","00000001")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"SNMP Community","REG_SZ","public")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"SNMP Enabled","REG_DWORD","00000000")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"SNMP Index","REG_DWORD","00000001")
RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip,"Version","REG_DWORD","00000001")
EndIf
If Not RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\"&$name, "Name") Then
GUICtrlSetData($label2,"Installation "&$name&" en cours...")
_RunDOS("rundll32 printui.dll,PrintUIEntry /if /f """&$inf&""" /u /b """&$name&""" /r ""IP_"&$ip&""" /m ""HP Universal Printing PCL 5""")
_RunDOS('"rundll32 printui.dll,PrintUIEntry /q /Xs /n "'&$name&'" Comment "'&$location&'""')
_RunDOS('"rundll32 printui.dll,PrintUIEntry /q /Xs /n "'&$name&'" Location "'&$location&'""')
GUICtrlSetData($label2,"Relance Spooler en cours...")
_RunDOS('net stop "'&$sServiceName&'"')
_RunDOS('net start "'&$sServiceName&'"')
EndIf
Next
FileClose($file)
GUIDelete()
endmsg()
#endregion
#region FUNCTIONS
Func endmsg()
$m2 = "Installation terminée"
MsgBox(0, "RICHEMONT INFORMATIQUE", $m2)
DirRemove(@Tempdir&"\Sources_Regus",1)
Exit
EndFunc
#endregion

and printers uninstall :

#cs ----------------------------------------------------------------------------
AutoIT:     3.3.6.0
Author:     Infrastructure@2010
Function:   Uninstall Regus Printers
#ce ----------------------------------------------------------------------------
Break(1)
#region AUTOIT VARIABLES
#include <Array.au3>
#include <Process.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#endregion
#region SCRIPT VARIABLES
Local $avArray
Local $file=FileOpen(@Tempdir&"\Sources_Regus\printers.inf", 0)
Local $sServiceName="Spooler"
#endregion
#region DIRECTORY & DRIVERS
DirCreate(@Tempdir&"\Sources_Regus")
FileInstall("Sources_Regus\printers.inf", @Tempdir&"\Sources_Regus\printers.inf", 1)
#endregion
#region GUI
$gui=GuiCreate("", 300, 80, -1, -1, $WS_POPUPWINDOW)

$label1=GUICtrlCreateLabel(""&StringTrimRight(StringUpper(@ScriptName),4), 0, 10, 286, 17, $SS_CENTER)
GUICtrlSetFont(-1, 9, 800)
$label2=GUICtrlCreateLabel("Vérification en cours...", 1, 40, 286, 17,$SS_CENTER)
GUISetState(@SW_SHOW,$gui)
#endregion
#region SCRIPT
$i=1
For $i=1 To 8
$avArray=StringSplit(FileReadLine($file,$i),",")
If @error = -1 Then ExitLoop
$ip=_ArrayToString($avArray, @TAB, 1, 1)
$name=_ArrayToString($avArray, @TAB, 2, 2)
$location=_ArrayToString($avArray, @TAB, 3, 3)
If RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\"&$name, "Name") Then
GUICtrlSetData($label2,"Suppression imprimante "&$name&" en cours...")
RunWait('"' & @ComSpec & '" /c rundll32 printui.dll,PrintUIEntry /dl /n "' &$name& '"', "", @SW_HIDE)
RegDelete("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"&$ip)
EndIf
Next
GUICtrlSetData($label2,"Relance Spooler en cours...")
_RunDOS('net stop "'&$sServiceName&'"')
_RunDOS('net start "'&$sServiceName&'"')
FileClose($file)
GUIDelete()
endmsg()
#endregion
#region FUNCTIONS
Func endmsg()
$m2 = "Supression terminée"
MsgBox(0, "RICHEMONT INFORMATIQUE", $m2)
DirRemove(@Tempdir&"\Sources_Regus",1)
Exit
EndFunc
#endregion
Posted

Hello

I haven't a problem.

I just need some help to delete printers who are not inlude in my inf file.

I the printer installed on the computer is not in the inf file then delete this printer and his port.

I the printer installed on the computer is in the inf file then next in my loop.

Sorry for my bad english, it's difficult for me to explain

Thanks for help

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...