Re: Removing a Keychain Item
Re: Removing a Keychain Item
- Subject: Re: Removing a Keychain Item
- From: Jim Mitchell <email@hidden>
- Date: Fri, 30 Dec 2005 08:37:32 -0800
- Organization: Jim Mitchell Designs
John,
Good stuff! Does exactly what I was looking for. Thank you VERY much for taking the time to dink with it.
Again, the knowledge of the list pays off...
Happy New Year to All,
Jim Mitchell
---
Email: email@hidden
Web: http://www.jimmitchelldesigns.com
AIM: jmitchelldesigns
On Thu, 29 Dec 2005 17:24:50 -0800, John Baltutis wrote:
> On 29 Dec 2005, Jim Mitchell <email@hidden> wrote:
>>
>> I'm trying to remove a keychain item (a generic key) that has been
>> tested and
>> determined incorrect due to the user changing their account
>> password.
>> I attempt the following:
>>
>> property theKey : "myApp"
>>
>> tell application "Keychain Scripting"
>> set keyList to (name of every generic key of current keychain)
>> repeat with x from 1 to (length of keyList)
>> if item x of keyList is theKey then
>> delete (key theKey)
>> -- also tried "delete (the key whose name is theKey)"
>> exit repeat
>> end if
>> end repeat
>> end tell
>>
>> I either get an "Access not allowed" error, or "Can't get key..." error
>> depending on what I'm trying. Any takers?
>
> After a few trials, I saw this in the event log on my system:
>
> tell application "Keychain Scripting"
> get every generickey of current keychain
> {generic key 1of keychain "login.keychain", generic key 2 of keychain
> "login.keychain"}
>
> Thus, this works, using the same structure and substituting my key's
> name for your key's name:
>
> property theKey : "myApp"
>
> tell application "Keychain Scripting"
> set keyList to every generic key of current keychain
> repeat with x from 1 to (length of keyList)
> if the name of item x of keyList is theKey then
> delete generic key x of current keychain
> exit repeat
> end if
> end repeat
> end tell
_______________________________________________
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