Lasso Soft Inc. > Home

[stdin_hidden]

Linkstdin_hidden
AuthorKe Carlton
CategoryAction
Version9.x
LicensePublic Domain
Posted31 Aug 2012
Updated31 Aug 2012
More by this author...

Description

Sample Usage

#!/usr/bin/lasso9
define stdin_hidden...

local(p) 

while(not #p) => {
  #p = stdin_hidden('What is your password?')
}

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define stdin_hidden(prompt::string='Please enter your password:') => {
	local(
		esc = decode_base64('Gw=='),
		cap = currentcapture
	)

	// Clear conceal flag
	handle => { stdout(#esc + '[0;0;28m') }

	// Set hidden flag
	stdout(#prompt + ' ' + #esc + '[30;40;1;8m')
	
	// Wait for input
	local(r) = file_stdin->readsomebytes(1024,100)
	while(not #r or #r->size == 0) => {
		#r = file_stdin->readSomeBytes(1024, 1000)
	}	

	// Cursor up
	stdout(#esc + '[1F')
	
	// Cursor right
	stdout(#esc + '['+#prompt->size->asstring+'C')

	// Delete hidden password
	stdoutnl(#esc + '[0K')

	// Return input
	return #r
}

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft