Me confused

code:
  IF primapstate($key)
IF primapstate($key)=2
$nul=delprinterconnection($key)
$nul=addprinterconnection(readprofilestring("$pmap","PRINTER_MAP",$key))
$nul=SETDEFAULTPRINTER (READPROFILESTRING("$pmap","PRINTER_MAP",$key))
ENDIF
$nul=delprinterconnection($key)
$nul=addprinterconnection(readprofilestring("$pmap","PRINTER_MAP",$key))
ENDIF

If I read this correctly it deletes the printer twice if the printer is the default one, Correct?

Should it not be:
code:
  IF primapstate($key)
$nul=delprinterconnection($key)
$nul=addprinterconnection(readprofilestring("$pmap","PRINTER_MAP",$key))
IF primapstate($key)=2
$nul=SETDEFAULTPRINTER (READPROFILESTRING("$pmap","PRINTER_MAP",$key))
ENDIF
ENDIF

_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...