Re: Fast KeyChain Functions...
Re: Fast KeyChain Functions...
- Subject: Re: Fast KeyChain Functions...
- From: kai <email@hidden>
- Date: Thu, 26 May 2005 11:32:59 +0100
On Thursday, May 26, 2005, at 05:09 am, Gary (Lists) wrote:
"kai" wrote:
On Wednesday, May 25, 2005, at 11:52 pm, David Crowe wrote:
I don't think your script would work in Panther or earlier. It looks
like Tiger has fixed the problem where the phrase "first key whose
name is k" would generate an error.
It might seem that way David, but the script is actually an extract
from a larger one that was written and tested in pre-Panther OS 10.2.8
(where both original and extract still work fine). That's why I was
having difficulty in understanding what you meant... :-)
Kai, in X.3.9, the script generates an error -1728, OMM.
Local sources (which may be dated?) suggest this for that error code:
errAENoSuchObject = -1728,
/* e.g.,: specifier asked for the 3rd, but there are only 2.
Basically, this
indicates a run-time resolution error. */
I do think that's a 'whose' clause issue.
Thanks Gary - that would help to explain a few things.
Error number -1728 and I are old friends, and the whose clause could
certainly be triggering it in this case. (In fact, there's little else
in the script that could.) This might help to confirm it:
----------------
tell application "Keychain Scripting" to tell current keychain to try
keys whose name is (get name of key -1)
on error e number n
e & " (" & n & ")"
end try
----------------
That works here, but presumably returns the error for you*. If so, then
it evidently got broken in Panther sometime. This raises the question
of whether it actually has been fixed in Tiger. I got the impression
that David tried it there successfully, but confirmation would be
helpful.
* This time, I used the plural form "keys", which might just work
(although I'm doubtful). If it does, then there's still the option of
looping through the filtered list...
FWIW, filters attempting to use "starts with", "ends with", "contains",
etc. *do* fall over here:
----------------
tell application "Keychain Scripting" to tell current keychain to try
keys whose name contains (get name of key -1)
on error e number n
e & " (" & n & ")"
end try
--> "Keychain Scripting got an error: Can't get every key of current
keychain whose name contains \"blah blah\". (-1728)"
----------------
(I also tested with 'name' instead of 'account'. This makes a more
logical
choice for me, where I often have Internet keys with the same 'name'
but
different 'account'.)
Yeah - I have a few similar cases, too. My original script dealt with
that issue. (Might dust it off for more general consumption - if the
above problem isn't too widespread...)
But a script like this would be great, because my favorite passcode
keeper
is OS9 and I know I need to wean myself.
So, given the above, you could be moving then... hello, Tiger? ;-)
---
kai
_______________________________________________
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