#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" Asking Password2"on preOpenStack if the short name of me <> the short name of this stack then exit preOpenStack set the style of this stack to "modeless" set the loc of this stack to the screenLoc end preOpenStack %Asking Password in a Customary Field ULucida Grande ULucida Grande WLucida Grande WLucida Grande WCourier UCourier UCourier UCourier AULucida Grande UVerdana @UVerdana UGeorgiaUGeorgiaPulldown Menu cREVGeneral scriptChecksums8FX>k debugObjects handlerList preOpenStack breakPointsscriptSelectionchar 198 to 197 bookmarks prevHandlercommandKeyDown tempScriptscript

on preOpenStack

if the short name of me <> the short name of this stack then exit preOpenStack

set the style of this stack to "modeless"

set the loc of this stack to the screenLoc

end preOpenStack

uRip Pon preOpenCard choose browse tool set the loc of this stack to the screenLoc focus on fld "Password" select text of fld "Password" end preOpenCard  cREVGeneralscriptChecksumYf~6& bookmarks handlerList preOpenCard tempScript prevHandler preOpenCardscriptSelectionchar 107 to 106script

on preOpenCard

choose browse tool

set the loc of this stack to the screenLoc

focus on fld "Password"

select text of fld "Password"

end preOpenCard

@BlackCheckmark.png PNG  IHDR  pHYs  gAMA|Q cHRMz%u0`:o_FxIDATxb` 17 R@L:̤/@,0@1I +x%@LħHW ť$@PIV dĊK806IENDB` cREVGeneral revUniqueID 1109347801497 CheckBox i -  cREVGeneral revUniqueID 1109350058804 Show ScriptEpon mouseUp

edit the script of fld "Password"

end mouseUp

 Password)pon rawKeydown pKey local tChunk,tPassword ----- if pKey = 65288 then -- delete key put word 1 to 4 of the selectedChunk into tChunk put the uPassword of me into tPassword if word 2 of tChunk > word 4 of tChunk then put word 4 of tChunk into word 2 to 4 of tChunk end if do "put empty into" && tChunk && "of tPassword" set the uPassword of me to tPassword pass rawKeydown else pass rawKeydown end rawKeydown ------------------------------------ on keyDown pKey local tChunk,tPassword ----- if the selectedChunk = empty then pass keyDown put word 1 to 4 of the selectedChunk into tChunk put the uPassword of me into tPassword put numToChar(42) into the selectedChunk -- numToChar(42): "*" if chartonum(pKey) = 34 then -- replace any quote by "~" do "put numToChar(126) into" && tChunk && "of tPassword" else do "put" && quote & pKey & quote && "into" && tChunk && "of tPassword" set the uPassword of me to tPassword end keyDown ------------------------------------ on enterInfield Validate -- end enterInfield ------------------------------------ on returnInfield Validate -- end returnInfield ------------------------------------ on Validate local tPassword ----- put the uPassword of me into tPassword replace numToChar(126) with numToChar(34) in tPassword -- replace "~" by a quote put tPassword into fld "ClearString"-- displays the clear string -- replace this line (put tPassword...) by your statements :-) end Validate F uPassword q  cREVGeneralscriptChecksumkt Vх revUniqueID 1112608588937 bookmarks handlerList6rawKeydown keyDown enterInfield returnInfield Validate tempScript prevHandler enterInfieldscriptSelectionchar 903 to 902script

on rawKeydown pKey

local tChunk,tPassword

-----

if pKey = 65288 then -- delete key

put word 1 to 4 of the selectedChunk into tChunk

put the uPassword of me into tPassword

if word 2 of tChunk > word 4 of tChunk then

put word 4 of tChunk into word 2 to 4 of tChunk

end if

do "put empty into" && tChunk && "of tPassword"

set the uPassword of me to tPassword

pass rawKeydown

else pass rawKeydown

end rawKeydown

------------------------------------

on keyDown pKey

local tChunk,tPassword

-----

if the selectedChunk = empty then pass keyDown

put word 1 to 4 of the selectedChunk into tChunk

put the uPassword of me into tPassword

put numToChar(42) into the selectedChunk -- numToChar(42): "*"

if chartonum(pKey) = 34 then -- replace any quote by "~"

do "put numToChar(126) into" && tChunk && "of tPassword"

else do "put" && quote & pKey & quote && "into" && tChunk && "of tPassword"

set the uPassword of me to tPassword

end keyDown

------------------------------------

on enterInfield

Validate -- 

end enterInfield

------------------------------------

on returnInfield

Validate -- 

end returnInfield

------------------------------------

on Validate

local tPassword

-----

put the uPassword of me into tPassword

replace numToChar(126) with numToChar(34) in tPassword -- replace "~" by a quote

put tPassword into fld "ClearString"-- displays the clear string

-- replace this line (put tPassword...) by your statements :-)

end Validate

 ClearEpon mouseUp lock screen put empty into fld "Password" put empty into fld "ClearString" unlock screen set the uPassword of fld ID 1047 to empty end mouseUp kE< cREVGeneralscriptChecksum$ I57 {;t bookmarks revUniqueID 1112609234586 handlerListmouseUpscriptSelectionchar 108 to 107 prevHandlermouseUp tempScriptscript

on mouseUp

lock screen

put empty into fld "Password"

put empty into fld "ClearString"

unlock screen

set the uPassword of fld ID 1047 to empty

end mouseUp

 ClearStringon rawKeydown pKey local tChunk,tPassword ----- if pKey = 65288 then -- delete key put word 1 to 4 of the selectedChunk into tChunk put the uPassword of me into tPassword if word 2 of tChunk > word 4 of tChunk then put word 4 of tChunk into word 2 to 4 of tChunk end if do "put empty into" && tChunk && "of tPassword" set the uPassword of me to tPassword pass rawKeydown else pass rawKeydown end rawKeydown ------------------------------------ on keyDown pKey local tChunk,tPassword ----- if the selectedChunk = empty then pass keyDown put word 1 to 4 of the selectedChunk into tChunk put the uPassword of me into tPassword put numToChar(42) into the selectedChunk -- numToChar(42): "*" if chartonum(pKey) = 34 then -- replace any quote by "~" do "put numToChar(126) into" && tChunk && "of tPassword" else do "put" && pKey && "into" && tChunk && "of tPassword" set the uPassword of me to tPassword end keyDown ------------------------------------ on enterInfield Validate -- end enterInfield ------------------------------------ on returnInfield Validate -- end returnInfield ------------------------------------ on Validate local tPassword ----- put the uPassword of me into tPassword replace numToChar(126) with numToChar(34) in tPassword -- replace "~" by a quote put tPassword -- put the clear string into the message box -- replace this line (put tPassword) by your statements end Validate @i uPassworddfse~ cREVGeneralscriptChecksum ?33WͣX bookmarks revUniqueID 1112616346601 handlerList6rawKeydown keyDown enterInfield returnInfield ValidatescriptSelection char 19 to 18 prevHandler enterInfield tempScriptscript

on rawKeydown pKey

local tChunk,tPassword

-----

if pKey = 65288 then -- delete key

put word 1 to 4 of the selectedChunk into tChunk

put the uPassword of me into tPassword

if word 2 of tChunk > word 4 of tChunk then

put word 4 of tChunk into word 2 to 4 of tChunk

end if

do "put empty into" && tChunk && "of tPassword"

set the uPassword of me to tPassword

pass rawKeydown

else pass rawKeydown

end rawKeydown

------------------------------------

on keyDown pKey

local tChunk,tPassword

-----

if the selectedChunk = empty then pass keyDown

put word 1 to 4 of the selectedChunk into tChunk

put the uPassword of me into tPassword

put numToChar(42) into the selectedChunk -- numToChar(42): "*"

if chartonum(pKey) = 34 then -- replace any quote by "~"

do "put numToChar(126) into" && tChunk && "of tPassword"

else do "put" && pKey && "into" && tChunk && "of tPassword"

set the uPassword of me to tPassword

end keyDown

------------------------------------

on enterInfield

Validate -- 

end enterInfield

------------------------------------

on returnInfield

Validate -- 

end returnInfield

------------------------------------

on Validate

local tPassword

-----

put the uPassword of me into tPassword

replace numToChar(126) with numToChar(34) in tPassword -- replace "~" by a quote

put tPassword -- put the clear string into the message box

-- replace this line (put tPassword) by your statements

end Validate

  Info p6on linkClicked go stack "revDocs" end linkClicked  cREVGeneralscriptChecksum eyj֤s bookmarks revUniqueID 1109350253372 handlerList linkClickedscriptSelection char 36 to 35 prevHandler tempScriptscript

on linkClicked

go stack "revDocs"

end linkClicked

 #How-To stack #012 by Eric Chatonet @" @ 4/03/05 Initial release @  55/27/05 Modified for Tutorials Picker compatibility  - F7/23/05 Corrected a bug in keyDown handler thanks to George Brackett  ) 0 @6 hThis stack shows how to ask a password in a customary field without showing what the user types. Enjoy! @g KRevolution provides the ask password command which diplays a modal dialog. @ @ @$&