I am trying to write a script that will add a new key to a dictionary plist. The script works fine when using a string for the key of the dictionary but I can't seem to figure out how to use a variable for the keyname. The script is below and is almost working. THe only issue is being able to use keyName as a variable instead of a string literal (which it is doing now).
on pListAddValueForKey(plistFile, keyName, keyValue)
tell application "System Events"
tell property list file plistFile
tell contents
set previousValue to value
set value to (previousValue & {keyName:keyValue}) -- this is the line in need of assistance
end tell
end tell
end tell
end pListAddValueForKey