Re: Keychain scripting...
Re: Keychain scripting...
- Subject: Re: Keychain scripting...
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 14 May 2004 10:44:15 -0700
On 5/14/04 9:21 AM, "David Crowe" <email@hidden> wrote:
>
I use the following code to access the KeyChain:
>
>
>
tell application "Keychain Scripting"
>
set KeyList to every key of keychain KeychainName
>
repeat with aKey in KeyList
>
if name of aKey = PINKeychain then
>
set theSecuridPIN to (password of aKey)
>
exit repeat
>
end if
>
end repeat
>
end tell
>
>
>
>
I do a loop because I couldn't reliably pull out the right record by
>
name. PinKeychain is just a string. and "KeychainName" is just the
>
name of the keychain.
>
>
For example:
>
>
key of keychain "DavidCrowe" whose name contains "a"
>
>
returns the error:
>
Can't get key of keychain "DavidCrowe" whose name contains "a"
Correct syntax is
first key key of keychain "DavidCrowe" whose name contains "a"
However, the problem I'm getting (in Panther OS 10.3.3) is that
every key of keychain KeychainName
--> {}
is a list of no items no matter which keychain I use. So 'first key whose
[anything is anything]' is always going to be an error. And looping through
KeyList is going to produce nothing at all since the list is empty. It seems
to be broken.
A shame, since I even came up with a good way to avoid the OS 9 Keychain
Scripting app from coming up.
set osXKeychainScriptingPath to (path to scripting additions from system
domain as Unicode text) & "Keychain Scripting.app:" -- one line
using terms from application "Keychain Scripting"
tell application osXKeychainScriptingPath
set KeyList to every key of current keychain
repeat with aKey in KeyList
if name of aKey = "AppleID" then
set theSecuridPIN to (password of aKey)
exit repeat
end if
end repeat
end tell
end using terms from
It gets
set allNames to (name of every keychain)
just fine, but substituting any of them (keychain "login.keychain", keychain
3) instead of (current keychain) doesn't help at all.
--
Paul Berkowitz
_______________________________________________
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.