Hi,
the following script is one I have for editing a .plist file to be able to change preferences for Aperture.
Sometimes it works but more often it doesn’t write the change into the .plist file.
Anyone knows what might be the problem here?:
tell application "System Events"
make new property list item at end of property list items of contents of property list file ((path to preferences folder from user domain as text) & "com.apple.Aperture.plist") with properties {kind:string, name:"LibraryPath", value:"/Volumes/HD2/Aperture_iPhoto/Aperture_Sjungarna_Projekt.aplibrary"}
end tell
Same result with this:
tell application "System Events"
tell property list file ((path to preferences folder from user domain as text) & "com.apple.Aperture.plist")
tell contents
set value of property list item "LibraryPath" to "/Volumes/HD2/Aperture_iPhoto/Aperture_Sjungarna_Projekt.aplibrary"
end tell
end tell
end tell
Are you sure aperture is closed? Preference files are opened by the application and read at launch. Then they only overwrite the preferences file but almost never read them out again. When making changes to preferences files you have to be sure the application isn’t running as it’s support applications.
The application, Aperture, is not running.
this script sometimes returns “false” and then I open Calendar and Show Week Numbers are set to ON/true.
Doesn’t make sense…
tell application "Calendar" to quit
delay 2
tell application "System Events"
tell property list file ((path to preferences folder from user domain as text) & "com.apple.iCal.plist")
tell contents
set value of property list item "Show Week Numbers" to "NO" as boolean
end tell
end tell
end tell
delay 5
set the plistfile_path to ((path to preferences folder from user domain as text) & "com.apple.iCal.plist")
tell application "System Events"
set p_list to property list file (plistfile_path)
value of property list item "Show Week Numbers" of p_list
end tell