Secure Text & admin Password

WARNING NEWBIE!! :slight_smile:

I’ve written an Applscript do copy some files using the Ditto shell command but I want the user to put in their password, but an AppleScript App I can’t hide (change) there Password to ¢¢¢¢¢. I’ve been told it’s possible in AppleScript Studio to have a secure text field??

So my first question is: How do I use the secure text field command.

Here is my Script:
display dialog “What is the admin Password?” default answer “”
copy the result as list to {the thePassword, the button_pressed}

set theSourceFile to (quoted form of POSIX path of (“Macintosh HD:Users:benr:Desktop:thePref:”)) & “*”

set thePrefsFolder to (quoted form of POSIX path of (choose folder)) & “Library/Preferences/”

set command to "ditto -rsrc "
do shell script command & theSourceFile & space & thePrefsFolder password thePassword with administrator privileges

You can not use secure text fields with dialogs. You must create a custom window in your project and place text fields and buttons into the window in the orientation that you desire.

In Interface builder, create a text field in a window of your project. With the text field selected, go to the “Custom Class” pane (cmd-5) in the info window, and select “NSSecureTextField”. Save your project, and build it. Your text field should now only show ¢’s rather than text. You can still use the ‘contents’ property of the text field to get the value of the text that the user entered.

j

Thanks! This also helped with my project :slight_smile: