I'm not surprised, just about every line of your script is wrong.

Please study the manual and the samples we've provided so far. If you don't understand what the functions are doing then ask us to explain. At the moment code that you are producing is so badly formed that you are never going to be able to write scripts yourself.

Here is some code that will do what you need:
Code:
$sPrinter=GetDefaultPrinter()
If $sPrinter
"Default printer for this user is "+$sPrinter+@CRLF
Else
"No default printer found for this user."+@DRLF
EndIf

; GetDefaultPrinter() - Returns the default printer.
; Sets @ERROR=0 when a printer is found, 2 if no printer is found.
Function GetDefaultPrinter()
Dim $iIndex,$sGroup

$sGroup=EnumGroup($iIndex)
While @ERROR=0 AND $sGroup
If InStr($sGroup,"\") $sGroup=SubStr($sGroup,InStr($sGroup,"\")+1) EndIf
If InStr($sGroup,"P-")=1
$GetDefaultPrinter=SubStr($sGroup,3)
Exit 0
EndIf
$iIndex=$iIndex+1
$sGroup=EnumGroup($iIndex)
Loop
Exit 2
EndFunction



Before you move on, ensure that you understand how this function works.

Specifically, ensure you understand
  • Why there is a While...Loop construct
  • Why your use of @USERID was inappropriate
  • What the $iIndex variable is being used for
  • Why the line with the "\" substring is there
  • What the $GetDefaultPrinter variable is, and why it is set as it is.
  • What the "Exit" statements are being used for, and why they have numeric values
  • What the line "While @ERROR=0 AND $sGroup" is doing.