Break ON
CLS
; Altera o Titulo da Janela do MS-DOS
SetTitle ("Nome da Empresa [KiXtart @Kix]")
;================================================================
;= Função : DelPrinterConnections
;= Autor : Lonkero
;= UDF Site : http://www.kixtart.org/UDF/UDF_lister.php?what=post&code=83797
;= Contribuintes : Nenhum
;= Changes : Roberto Valentim
;= Descrição : Deleta todas as impressoas que foram adicionadas
;= apartir do servidor informado pelo parametro
;= $Server que devera ser informado.
;= Sintaxe : DelPrinterConnections($Server)
;= Parâmetros : $Server
;= Nome do Servidor
;= Retorna : Nada
;= Dependências : Nenhuma
;= Exemplo(s) : DelPrinterConnections("Servidor01")
;================================================================
Function DelPrinterConnections($Server)
;================================================================
DIM $c, $bk, $conn, $Index, $KeyName[5], $element
$c = 0
$bk = "HKEY_CURRENT_USER\Printers\Connections"
For $Index = 0 to 5
$KeyName[$Index] = EnumKey($bk, $Index)
Next
For Each $element in $KeyName
$conn = enumkey($bk,$c)
If (SubStr($element,3,12) = $Server) = 0
$c= $c + 1
$conn= delkey($bk + "\" + $conn)
$conn= enumkey($bk,$c)
EndIf
Next
EndFunction
;================================================================
;= Função : ENumGroupIni
;= Autor : Kent Dyer
;= UDF Site : http://www.kixtart.org/UDF/UDF_lister.php?what=post&code=84431
;= Contribuintes : Jens Meyer
;= Howard Bullock
;= Changes : Roberto Valentim
;= Descrição : Numera todos os grupos que estão no arquivo ini
;= que deverá ser informado pelo parametro $file
;= e o servidor no qual o grupo faz parte pelo
;= pelo parametro $Server.
;= Sintaxe : ENumGroupIni($file)
;= Parâmetros : $file
;= Arquivo para ser lido e usado
;= Retorna : Nada
;= Dependências : Nenhuma
;= Exemplo(s) : ENumGroupIni("C:\print.ini")
;================================================================
Function ENumGroupIni($file)
;================================================================
DIM $GrpArray, $Grupo, $GrpChave, $Chave, $Valores, $Valor
$GrpArray = split(readprofilestring($file, "", ""), chr(10))
For Each $Grupo in $GrpArray
If ($Grupo <> "")
If InGroup("$Grupo") = 0
$InGroups = $InGroups + "$Grupo"
$GrpChave = split(readprofilestring($file, $Grupo, ""), chr(10))
For Each $Chave in $GrpChave
If ($Chave = "Printers")
$Valores = split(readprofilestring($file, $Grupo, $Chave), ",")
For Each $Valor in $Valores
AddPrinterConnection("$Valor)
Next
EndIf
If ($Chave = "Default")
$Valores = split(readprofilestring($file, $Grupo, $Chave), ",")
For Each $Valor in $Valores
SetDefaultPrinter("$Valor)
Next
EndIf
Next
Else
EndIf
EndIf
Next
EndFunction
DelPrinterConnections("Server01")
ENumGroupIni("print.ini")