Thanks four replays.

I tried this and it worked, now is my question is this code good?
Whats the difference between
IF ADDPRINTERCONNECTION ("\\w2k3dc\hpl4") =0
? "Printer added"
AND
ADDPRINTERCONNECTION ("\\w2k3dc\hpl4")
?

should I close every IF with and ENDIF eg.
IF ADDPRINTERCONNECTION ("\\w2k3dc\hpl4") =0
? "Printer added"
ENDIF
IF ADDPRINTERCONNECTION ...

Script:
;Delete all existing networkprinters
DelTree("HKEY_CURRENT_USER\Printers\Connections")
AddKey("HKEY_CURRENT_USER\Printers\Connections")

;Check location depending on clientname
$Datornamn = LEFT(%clientname%,6)

;Connect the right printer to this terminal
SELECT
CASE ($Datornamn = TSPS18)
IF ADDPRINTERCONNECTION ("\\w2k3dc\hpl4") =0
? "Printer added"
IF ADDPRINTERCONNECTION ("\\w2k3dc\hp") =0
? "Printer added"
IF SETDEFAULTPRINTER ("\\w2k3dc\hp") =0
? "Default printer"

CASE 1
$Selection = MessageBox("Clientname unknown. No printer connections available at this moment. Please contact you system administrator.", "Printerinfo", 64)
IF $Selection = 1
EXIT
ENDIF
ENDSELECT


Edited by Riwe (2004-06-24 03:38 PM)