Tiger upgrade broke keychain scripts

I have a number of keychain scripts that now seem to be broken since I upgraded to Tiger every time I try to access the keys.password property. When that line is reached I get a dialog box with the following text: “The username or password you entered is not correct”.

Can’t find out if the keychain dictionary has changed or whether the keychain itself has changed - any ideas?

FYI I hardcoded the password and it worked fine.

on getKeyInfo(keyName)
	tell application "Keychain Scripting"
		set homeKeys to keys of keychain (1)
		repeat with currentKey in homeKeys
			if name of currentKey is keyName then
				exit repeat
			end if
		end repeat
		set keyAccount to account of currentKey
		set AppleScript's text item delimiters to {","}
--this line is broken
		set keyPasswordInfo to password of currentKey
--this line is broken
	end tell
end getKeyInfo

I had a similar script break with a system upgrade. I’m not sure whether it was Panther or a particular upgrade to Panther. In any case, the syntax that works for me now (on Panther) is different than yours and I got the syntax, more or less, out of the latest version of O’Reilly’s “AppleScript: The Definitive Guide.” I have this subroutine hard coded for a particular purpose but I presume you could expand it to do the other things you want to do.

on get_password_from_keychain()
	tell application "Keychain Scripting"
		set k to get key 1 of keychain 1 whose name is "My key for my software"
		tell k to set pt_password to password
	end tell
	return pt_password
end get_password_from_keychain

Thankyou for your tip, it worked perfectly - and since most of my scripts call this keychain script I’ve fixed so many things in one go.