I’ve struck a problem in El Capitan where Dock icons that are dragged off are not removed from the permanent .plist Dock Preferences.
I want to restore any ‘invisible’ dock icons that are still listed, via applescript, but can’t get my terminology correct.
set plistpath to (path to preferences folder as text) & "com.apple.dock.plist"
tell application "System Events"
set plistContents to contents of property list file plistpath
set pListItems to value of plistContents
end tell
set persistentAppsList to |persistent-apps| of pListItems
set persistentApps to items of pListItems
set dockAppsList to {}
try
repeat with thisRecord in persistentAppsList
set theTileData to |tile-data| of thisRecord as record
if (|file-label| of theTileData as text) is "Mail Manager" then
say 1
tell application "System Events"
tell property list item |tile-data| of property list item thisRecord
set value of property list item "showas" to "1"
end tell
end tell
set end of dockAppsList to (|file-label| of theTileData as text)
end if
end repeat
end try
tell application "Dock" to quit
dockAppsList & return & persistentApps