I am trying to make a simple script that adds a key to the keychain for an appleshare connection… eventually have it loop and create keys for all the accounts in our computer lab (the keychains seem to get garbled after a few weeks, for some reason, and i’d like to be able to easily rebuild them). When I run the following code, nothing seems to work… it worked once but I didn’t notice it, and I have since changed it, so I know I’m close…

OS version: OS X

set theUserID to "labadmin"
set thePassword to "testpass"

tell application "Keychain Scripting"
		set kc_Name to "testkey"
		set kc_Account to theUserID
		set kc_Password to thePassword
		set kc_Description to "AppleShare password"
		set kc_Comment to "This item was created by the buildKeys AppleScript"
		make new AppleShare key with properties {name:kc_Name, account:kc_Account, password:kc_Password}
	on error
		display dialog "Error creating keychains!"
	end try
end tell