Fun with keychain scripting....
Fun with keychain scripting....
- Subject: Fun with keychain scripting....
- From: David Crowe <email@hidden>
- Date: Thu, 22 Jan 2004 16:11:42 -0700
I'm trying to write a little utility that will obtain a password from
the keychain. So far I have:
display dialog "Enter name of key or password to view" default answer ""
set KeyName to text returned of the result
tell application "Keychain Scripting"
tell keychain "dad"
repeat with i from 1 to (count keys of it)
if (name of key i) begins with KeyName then
tell me to display dialog "Password="
& (password of key i)
return
end if
end repeat
end tell
end tell
tell me to display dialog "Did not find key <" & KeyName & ">"
Sometimes this work, but other times I get the error:
Can't make +class ppas; of +class ckey; 104 of +script; into a string
Since all the types of key inherit from the basic class "key", how
could there be a password that isn't a string (the dictionary defines
'password' as a string). Is it me? Or AppleScript?
Also, I'd like to eliminate the repeat loop (it's quite slow) but:
password of key whose name is "xyz"
doesn't work (error is "Can't get key whose name = "xyz".).
- David Crowe
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.