Jump to content
Sign in to follow this  
ejbmail

Help using printui.dll,PrintUIEntry for Printer Control

Recommended Posts

ejbmail

Why does this only delete 2 printer when there is 5 to delete?

Whats wrong.....

For $i= 1 to 50

$var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers", $i)

if @error <> 0 then ExitLoop

if StringInStr($var,"OKI") > 0 Then

;found OKI printer entry

MsgBox(4096, "SubKey" & $i, $var)

$Printer = $var

$Printer2 = StringReplace($Printer,"@","\@")

$ret = RunWait(@ComSpec & " /c " & 'rundll32 printui.dll,PrintUIEntry /dl /n "'& $Printer &'"',"",@SW_HIDE)

if $ret <> 0 Then

_SendToCore("Unable to delete" & $Printer & "Unable to delete Printer" & $ret)

sleep(2000)

;exit $ret

EndIf

EndIf

Next

Exit 0

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×