John, Here is a modification of that Keychain script mentioned earlier. I'm now using this on my own system.
----- on startKeychainScripting()
-- This function ensures that the Keychain Scripting.app is launched by a process -- different from the one executing this script. It is only needed when using Keychain Scripting to -- retrieve the password property of a key.
-- Quit Keychain Scripting if it's running, since opening this script may have implicitly launched it. try tell application "System Events" set foundApp to first process whose name is "Keychain Scripting" set pid to id of foundApp -- this will exit the try block if the process isn't running quit foundApp -- we get here if the process is found end tell end try
-- get Finder to launch Keychain Scripting tell application "Finder" open application file ((startup disk as string) & "System:Library:ScriptingAdditions:Keychain Scripting") as alias end tell
-- make sure that Keychain Scripting is up and running repeat while true try tell application "System Events" set foundApp to first process whose name is "Keychain Scripting" set pid to id of foundApp -- this will exit the try block if the process isn't running end tell exit repeat -- we get here if the process is found end try end repeat
end startKeychainScripting
startKeychainScripting() tell application "Keychain Scripting" set allKeys to the name of every key of keychain 1 end tell --Part 1: set keyname to (choose from list allKeys) set keyname to keyname as string --Part 2: tell application "Keychain Scripting" try set theKey to first key of current keychain whose name is keyname set thePassword to password of theKey on error message number errNum set thePassword to message & " (" & errNum & ")" end try end tell display dialog thePassword ----------
Roy Whelden
|