Sub HiddenCLIInput
'--- Accepts an input from the user w/o displaying what is being typed
'--- Returns HIPWStr as the string typed
'--- Accepts HIPWMax as maximum # of chars which HIPWStr can have
If HIPWMax <= 0 Then ' Max # of chars which can be accepted from user
HIPWMax = 255 ' If HIPWMax is undetermined, use default 255
EndIf
HIPWKey = "" ' Typed char to be analysed
HIPWStr = "" ' Password result formed outta accepted HIPWKey chars
HiddenChars = "" ' Which HIPWStrDisplay derives from
HiddenChar = STAR ' Char displayed in place of what is being typed
EnterKey = CR ' Key to confirm the input
DeleteKey = BS ' Key to delete last char stored in HIPWStr
For num = 1 To HIPWMax
HiddenChars = HiddenChars + HiddenChar
EndFor
EndSub
'------------------------------------------------------------------------------------------------------------'
Sub HiddenInputLoop
While HIPWKey <> EnterKey
HIPWKey = TextWindow.ReadKey() ' Waits next key to be hit
HiddenInputParse() ' Decides if it can be accept
HiddenInputHide() ' Replaces typed by HiddenChars
EndWhile
EndSub
'------------------------------------------------------------------------------------------------------------'
Sub HiddenInputParse
HIPWKeyCode = Text.GetCharacterCode(HIPWKey)
If HIPWKeyCode >= 32 Then ' Tests if printable
HIPWStr = Text.Append(HIPWStr HIPWKey) ' Creates PW string
EndIf
HIPWStrLen = Text.GetLength(HIPWStr)
If HIPWStrLen > HIPWMax Then ' Checks if size passed limit
HIPWKey = DeleteKey
EndIf
If HIPWKey = DeleteKey Then ' Deletes last char typed
TextWindow.Write(SPC + BS + BS + SPC + BS + BEL)
HIPWStr = Text.GetSubText(HIPWStr 1 HIPWStrLen-1)
EndIf
EndSub
'------------------------------------------------------------------------------------------------------------'
Sub HiddenInputHide