looks complex.
what's wrong with:
Code:

function ReplacePrinter($oldprinter, $newprinter)
$=addprinterconnection($newprinter)
if $oldprinter = join(split(readvalue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),',',1),'')
$=setdefaultprinter($newprinter)
endif
$=delprinterconnection($oldprinter)
Endfunction

_________________________
!

download KiXnet