Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Catch Deny from Keychain Permission Dialog?




> Also, it didn't
> beat the freeze after hitting "Deny".

I know it's not ideal by any means, but it did quit the keychain dialog and
throw an error for the script OMM. Are you sure you waited for 20 seconds?
The time can be shortened, of course.

Yes, it worked fine, but not pretty enough. ;)

Turns out security _did_ work well (I've left the text_to_list handler out; everyone knows what that is):

--
to get_keychain_info(service_name)
set {actname, pword} to {"", ""}
try
set x to (do shell script "security find-generic-password -s " & quoted form of service_name & " -g 2>&1")

set pword to first item of my text_to_list(last item of my text_to_list(x, "password: \""), "\"")
set actname to first item of my text_to_list(last item of my text_to_list(x, "\"acct\"<blob>=\""), "\"")

end try
return {actname, pword}
end get_keychain_info
--


The try block catches an error from security when "Deny" is clicked. This is _way_ faster than Keychain Scripting, too. I will probably do some grep and sed stuff to eliminate the ugly text_to_list routines.

Thanks for the attention,
Doug


-- Doug's AppleScripts for iTunes http://www.dougscripts.com/itunes/

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.