Hi,
First, excuse my bad english from Paris
I have a strange problem with “Keychain Scripting” in an AppleScript Application.
So your experience is welcoming. Thanks by advance.
Here my code :
- Look for the password in keychain to get the password :
on getAccountAndPassword(keyname)
set adminPass to ""
startKeychainScripting() -- Advice of Apple : http://docs.info.apple.com/article.html?artnum=301858
tell application "Keychain Scripting"
-- Here is my problem, application hang with an AppleEvent error timeout (-1712)
try
set theKey to first generic key of current keychain whose name is keyname
set adminPass to password of theKey
on error message number errNum
display dialog message
end try
end tell
return adminPass
end getAccountAndPassword
- Function to update or create key in keychain
on makeKey(maj, keyname, myLogin, myPassword)
startKeychainScripting()
tell application "Keychain Scripting"
-- Same problem AppleEvent timeout, what is the problem ????
tell current keychain
if maj then
try
set theKey to first generic key whose name is keyname
delete theKey -- To impove by setting directly with new password when i'll find the problem
end try
end if
make new generic key with properties ¬
{name:keyname, account:myLogin, password:myPassword, comment:"Authentification du MediaPlayer9"}
return result
end tell
end tell
end makeKey
I don’t see where is my error. I try to delete the keychain session, recreate it manually and reexecute the script without success.
I try all suggestion about keychain on this forum… and it’s always ko. Do you have any idea ?
Thank you very much for your help on this problem.
Gaëlle
Model: PowerBook PPC G4
AppleScript: 1.10.7
Browser: Firefox 1.5.0.7
Operating System: Mac OS X (10.4)