Re: Fast KeyChain Functions...
Re: Fast KeyChain Functions...
- Subject: Re: Fast KeyChain Functions...
- From: David Crowe <email@hidden>
- Date: Thu, 26 May 2005 10:37:53 -0600
Title: Re: Fast KeyChain Functions...
Kai;
I have tested some of the scriptlets that you provided regarding
the KeyChain.
Here are my results (using 10.3.9 Panther):
tell application "Keychain Scripting"
to tell current
keychain to
try
name
of keys whose name
is (get name
of key -1)
on
error e number n
e &
" (" & n & ")"
end try
This script works, but is very slow (almost 30 seconds on my 800
MHz TiBook). Plus it requires me to know the index of the key.
However, if I substitute the name I'm looking for, it still works, but
still takes about 30 seconds.
Based on this script it appears that the functionality of
KeyChain has been improved (i.e. you can query a key by name, not just
by index number), but not the speed. This may be because I have
238 items in my Keychain. With a small keychain database, the
performance problem might not be so obvious.
Ironically, using "name of every key" (i.e. without
qualification) takes only 10 seconds. Still a long time. But it shows
that it would be quicker to scan the list of names and access by index
number. But this is still several times slower than my scripts, as
complex as they might be.
The other script you suggested:
property k : ""
set m to
"Please enter a key to
find its password:"
repeat
set
k to (display dialog m default
answer k buttons ¬
{"Cancel", "Find"}
default button
2)'s text returned
try
tell
application
"Keychain
Scripting"
to tell current
keychain ¬
to
set p to password of first key
whose name is k
set
m to "The password for \"" & k & "\" is \"" & p & "\"."
on error errmsg
number n
if
n is -128 then
error
number n
set
m to "Could not get password for \"" & ¬
k &
"\". Please try
again."
& return & errmsg
end try
end
repeat
... did not work. The error message that I received was <Can't
get password of key 1 of current keychain whose name =
"Jane">
- David Crowe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden