Very old - might need some cleanup.. but you'll get the idea(s). Not NoVarsInStrings compliant, but I don't have access to the latest version (at work).

Glenn

 Code:
; get a string, according to defined rules
; Count specifies how many chars can be accepted
; Secure displays "*" instead of the chars typed
; Allowed is a string defining which chars will be accepted.
Function GetStr($Count, $Secure, OPTIONAL $Allowed)
 
  Dim $CC, $SF, $PC
 
  $CC = 0			; character count
  $GetStr = ""			; init return string
  $SF = 1			; string flag
  If $Allowed <> ""
    $Allowed = $Allowed + Chr(8) + Chr(13)
  EndIf
 
  While $SF = 1			; loop until done
    Get $PC			; get 1 character
 
    If $Allowed <> ""		; If allowed string is defined
      If InStr($Allowed, $PC) = 0 ;And ($PC <> Chr(13) or $PC <> Chr(8))
        $PC = ""		; char must be one of allowed
      EndIf
    EndIf
 
    Select
    Case $PC = Chr(8)		; handle backspace
      Chr(8) + " " + Chr(8)	; erase character
      $CC = $CC - 1		; reduce count
      If $CC > 0		; shorten or clear string
        $GetStr = Left($GetStr, $CC)
      Else
        $GetStr = ""
      EndIf
 
    Case $PC = Chr(13)		; handle Return
      $SF = 0
 
    Case $PC = ""		; handle non-allowed chars
      Beep
 
    Case 1			; got a char
      If $Secure
        "*"			; print "*" if secure
      Else
        "$PC"			; otherwise print the char
      EndIf
      $getStr = $GetStr + $PC	; add it to the string
      $CC = $CC + 1		; increment char count
    EndSelect
 
    ; Exit if character-count is reached
    If $Count > 0 and $CC = $Count
      $SF = 0
    EndIf
 
  Loop
EndFunction

_________________________
Actually I am a Rocket Scientist! \:D