I just updated my Mac OS to Mavericks and stuck in a issue in my project.
I an updating localization key in plist with apple script. But when I set the localization key plist file goes to 0 KB.
It was working in Mac OS 10.8.
Below is my script to change plist key :
if keyVar as string = "CFBundleLocalizations" then
-- Parse the string for delimiter , and get the array of schemes
set AppleScript's text item delimiters to ","
set theLanguageItems to text items of valVar
-- restore delimiters to previous.if not reset then creats error for below code if we have any property below CFBundleLocalizations propert file.
set AppleScript's text item delimiters to "="
--if there are localization available
if the length of theLanguageItems is greater than 0 then
--create structure for CFBundleLocalizations
tell application "System Events"
set pFile to property list file plistFile
tell pFile
tell contents
--and write to the plist file
--make new property list item with properties {kind:list, value:"theLanguageItems"}
set value of property list item "CFBundleLocalizations" to theLanguageItems
end tell
end tell
end tell
end if
In Mavericks it seems behavior difference for AppleScript, where set value of property list item
is not working as expected.
One alternate is to use make new property
that you have commented. In this case a new property will be created and appended to the existing one. Hence you need to be careful for that.
Below is actual solution that works for array list
repeat with theCurrentValue in theLanguageItems
make new property list item with properties {kind:string, value:theCurrentValue}
end repeat