Re: scripting keychain access - login keychain
Re: scripting keychain access - login keychain
- Subject: Re: scripting keychain access - login keychain
- From: John Stewart <email@hidden>
- Date: Thu, 13 May 2004 06:42:48 -0400
On 05/12/04 at -0500 travis n said this
>
Greetings John and thanks for the post.
Welcome, hope it will be of use.
>
>
Did you did an upgrade to 10.3.x or an clean/archive install.
>
Upgraded
>
It was common for 10.2.x to name the default keychain with the
>
username, but if a fresh install of 10.3 is done, it creates
>
login.keychain as the default keychain.
>
>
Either way, I have tried to get around this (as I don't know what the
>
users of this script will have) by using the current keychain term,
>
that returns login.keychain for me, which is my default keychain.
>
>
>
tell application "Keychain Scripting"
>
set defaultKeychain to current keychain
>
set uName to keys of defaultKeychain
>
end tell
>
>
Does this little snippet get the keys for you on your system?
Yes it returns a list of all the keys.
Going back to your original post, seems to me that all you need to find the correct keychain is the
users "short name".
This returns my .mac account name, it's only 2 lines long (watch out for line wrap). It could also
use a bit of error checking.
set uName to do shell script "id -nu" -- user short name
tell application "Keychain Scripting" to set uKey to account of (first Internet key of keychain uName
whose server is "www.mac.com")
JBS
--
OK, so what's the speed of dark?
_______________________________________________
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.