As far as I know there is no way to use a wildcard for setting the default printer but there must be a different solution to get it going.

You could use the SessionType() UDF to see if it is an ICA (citrix) session,check %CLIENTNAME% to get the name of the user's workstation and use the GetSessionID() UDF from the code below (could not find it in the UDF section) to get the session ID.

With all of this you should be able to construct the printer name like show below. Be careful because the code below is untested.

 Code:
Break on

If SessionType() = "ICA"
	;User is in an ICA session.

	;Get session number
	$session = GetSessionID()
	;Get client name
	$client = ExpandEnvironmentVars(%clientname%)
	;Set printer name
	$printer = "Citrix Universal Generic (From " + $client + ") in session " + $session
	;Set default printer
	$rc = SetDefaultPrinter($printer)
	;Check for errors
	If $rc <> 0
		? "There was an error."
		? @ERROR
		? @SERROR
	Else
		? "All is ok"
		? @ERROR
		? @SERROR
	EndIf
	Sleep 5	
EndIf

;FUNCTION      GetSessionID()
; 
;ACTION        Returns the Terminal Server session id 
; 
;AUTHOR        pearly 
; 
;CONTRIBUTORS  Richard H. (I'm almost reluctant to claiming this function as my own.  Thank you!) 
; 
;VERSION       1.0 
; 
;DATE CREATED  2005/03/06 
; 
;DATE MODIFIED 2005/03/06 
; 
;KIXTART       KiXtart 4.20 
; 
;SYNTAX        GetSession() 
; 
;PARAMETERS    None. 
; 
;RETURNS       Integer. 
; 
;REMARKS       Uses %TEMP% environment variable. 
; 
;DEPENDENCIES  None. 
; 
;EXAMPLE       Dim $session 
;			   $session = GetSessionID() 
; 
;KIXTART BBS    
; 
Function GetSessionID()
	Dim $s_sessionid
	Dim $iIndex
	$GetSessionID = 0
	$s_sessionid = SubStr(%TEMP%, 1 + InStrRev(%TEMP%, "\"))
	While $s_sessionid <> ""
		$iIndex = InStr("0123456789ABCDEF", Left($s_sessionid, 1))
		If $iIndex
			$GetSessionID = $GetSessionID * 16 + (CInt($iIndex - 1))
			$s_sessionid = SubStr($s_sessionid, 2)
		Else
			$GetSessionID = 0
			$s_sessionid = ""
		EndIf
	Loop
EndFunction
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.