Reputation: 19
Hello I am trying to remove and add a couple of specific apps from the default dock using a script.
tell application "System Events"
tell property list file "~/Library/Preferences/com.apple.dock.plist"
set value of property list item "Firefox.app" to null
end tell
end tell
this is what i have which throws an error
error "System Events got an error: Can’t set property list item \"Firefox.app\" of property list file \"/Users/immam.m/Library/Preferences/com.apple.dock.plist\" to null." number -10006 from property list item "Firefox.app" of property list file "/Users/immam.m/Library/Preferences/com.apple.dock.plist" to null
I also wanted to figure out a way to add apps to the array so it shows on the dock upon KIllall command.
Sorry if this is an easy process, pretty new to mac and applescript. Help is appreciated
Upvotes: 1
Views: 744
Reputation: 19
I figured it out using a different method
do shell script "
defaults write com.apple.dock persistent-apps -array
'<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>System/Applications/System Preferences.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
.. keep adding to the array
;
Killall Dock;"
Upvotes: 0