NEED NOW!!! Password Script!!!


Don’t laugh, I am but a novice. I have been having some touble creating a password screen.

What I want: The user would click on the script’s icon which would then take them to a dialogue box. Clicking on the right option, the user would then be taken to a password screen which would ask them simply and plainly: What is the password? Upon entering the correct password the user would then be taken through a series of dialogue boxes. If an incorrect password was entered then the user would be shown an image (preferably of a skull and crossbones or something devilish) and told to get the hell off the computer.

OOH - also I need a script which would ask a password on the computer’s awaking from sleep. (this is considerably less important)

I have no money to spare. Please be generous… all I need are some basic terms.


I well know that it is probably foolish to reply at all - but it is just to suggest that you go away. I think I can safely say that no-one here will give you the time of day. By all means, though, keep writing until you get fed up.

A true password text entry dialog cannot be done with the Standard Additions in AppleScript. You will need a 3rd party addition (osax) to do the job.

The command

set textEntered to text returned of (display dialog "What is the password?" default answer "")

will get the password, however when the user enters text it will appear in clear text format, not bullets, which is not standard nor recommended for password dialogs.
Using ‘if textEntered’ = “password” then’ and so on will guide the user to the dialogs or actions you specifiy. If you want a custom icon in a standard dialog, prepare to hack script files with resedit and learn the difference between an icon and a cicn resource. If you can get by with a pic of a skull and crossbones then just have the Finder open a .jpg/.gif/.tiff (or any QT image) file.

And considerably more difficult.

The basic terms would be ‘display dialog’ and all the associated parameters (buttons {x, y, z}, giving up after …, and default answer “”). Beyond basics, it requires much more explination of how to build a dialog and functions using something like Dialog Director.

Ah! There’s a nice example of password protecting a folder on resexcellence. When the folder is opened, a dialog appears asking for password.

on opening folder This_Folder
    tell application "Finder"
        set dialogresult to display dialog "Please enter the password to access folder:
                                 " & This_Folder & "" buttons {"Ok"} default button 1 default answer " "
        set PWText to the text returned of dialogresult
        if not PWText = "Password here" then
            close folder This_Folder
            beep 3
            display dialog "The password entered is incorrect" buttons {"Doh!"} default button 1
        end if
    end tell
end opening folder

Brad - I regret having upset you so much.

I have a strong objection to invitations to click on URLs with unidentifiable destinations - and I do not think such things have any place on a site such as this.

I thought that neither the tone nor the content of the posting suited the ethos of this site.

I objected to the disparity between the urgency suggested by the title and what I saw (you will disagree) as the banality of the request - and I did not think that the majority of MacScripters would think otherwise.

I freely admit that in your case I was wrong on all counts, very wrong. It was certainly far from my intention to offend someone like yourself. I perhaps owe you an apology for so doing, but my opinions remain unchanged.

Well, isn’t THAT the kind response!!! THE WHOLE PURPOSE OF THIS FORUM IS TO HELP EACH OTHER!! (yes, I was yelling!)

Hi Andreas,

As a newcomer to this site, I did not know what you meant by your post. I thought that Brad may have been one of those assholes who gain kicks from being abnoxious and was one of those regulars who gain satisfaction from some devious kind of plan. I am sorry Brad for thinking this way.

gl all, Kel.

i think the original poster’s tone was a bit too demanding. when i saw his request, i was hoping someone might reply with some hints (NOT a complete script) and possibly some suggestions on how to ask politely for help on these boards. we’ve all had to learn a lot of this stuff on our own. so in this case, it might be better to deal with the poster’s impatience by “teaching him how to fish.”

i’ve always been impressed by everyone’s respect and patience here. thanks, macscripter!

2¢ in the bucket…


I too owe you an apology. I did NOT see the URL at the bottom of the original post. I was surprised by your original post. I have always valued your posts. My response was a knee-jerk reaction. I know the desparation of the original post. As a graphic artist in a small print shop, I know deadlines. Telling the boss that all we do is put ink on paper doesn’t seem to over very well. Again, I apologise for such a strong reaction.