• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Password
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Password


  • Subject: Re: Password
  • From: Philip Aker <email@hidden>
  • Date: Sat, 19 Sep 2009 01:23:06 -0700

On 2009-09-18, at 23:39:18, Jarrod Coffin wrote:

Hello i started out making a simple app that would show hidden files but as i thought about it I dont want just anyone being able to access this app with out a password. I have most of the script but its not compiling right and i cant figure out why. Im also pretty new to this.

here is the script i have already:

tell application "Finder" to quit
display dialog "Show Hidden Files..." buttons {"ON", "OFF"} default button "ON"

copy the result as list to {buttonpressed}

(*try
if the buttonpressed is "OFF" then do shell script "defaults write com.apple.finder AppleShowAllFiles OFF"
if the buttonpressed is "ON" then

set the_password to "password" --set this to the password you want to use

set correct_pass to false
set the_dialog to "Please enter your password:"
repeat while correct_pass is false
display dialog the_dialog default answer "" buttons {"Cancel", "OK"} default button 2 with icon 0 with hidden answer
if the text returned of the result is the_password then
do shell script "defaults write com.apple.finder AppleShowAllFiles ON"
else
beep
set the_dialog to "Incorrect password." & return & "Please enter your password:"
end if
end repeat

end try
*)
tell application "Finder" to launch


the middle part is what im stuck on if you could help that would be great!

Here's one way to do it:

script VerifyPassword
property module_password : "password"
property prompt : "Please enter your password:"
on run {}
set correct_password to false
try
repeat while correct_password is false
display dialog prompt default answer "" default button "OK" with icon note with hidden answer
if (text returned of result is module_password) then
set correct_password to true
exit repeat
else
beep
end if
end repeat
end try
return correct_password
end run
end script

set proceed to (run script VerifyPassword)
if (proceed is true) then
--script
end if

Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Password
      • From: Barry Wainwright <email@hidden>
References: 
 >Password (From: Jarrod Coffin <email@hidden>)

  • Prev by Date: Mail scripting
  • Next by Date: Re: Mail scripting
  • Previous by thread: Password
  • Next by thread: Re: Password
  • Index(es):
    • Date
    • Thread