Password masking


Is there anyway I can mask text entered into a field so that it displays bullets instead of the real letters? I tried using “AskPassword” OSAX but found that it does not return the button pressed (if cancel is pressed it “returns” and ends the script).

Is there any masking OSAX out there? Or any way to do this?


I’m not familiar with that particular OSAX but you might be able to get around the cancel button problem. Define the cancel button as " Cancel " instead of “Cancel” and see if that returns the button returned as you desire.

No… sounds like the OSAX is doing what it should do when “Cancel” is clicked…

Normally when a “Cancel” button is clicked in an AppleScript (when using display dialog for example) you don’t get a button returned and the script terminates. That’s the way it’s supposed to work.

Typically if you want to detect when a “Cancel” button is clicked, enclose the call to the OSAX (or to display dialog) in a “try… on error… end try” block. Then, in the “on error” portion of the block test for the presence of a -128 error (which is a “user cancelled” error). If you get a -128 then the user clicked “cancel” and you can do whatever you need, if it’s some other error then you’ll have to deal with it appropriately.

If the script doesn’t fall into the “on error” portion of the block then the user didn’t click “cancel” and you should have valid data in the reply record.