Mac OS X Dock Management

(imported topic written by dsalima91)

Hello Everyone,

I’m working on a fixlet that leaves an icon in the Dock of Mac OS X. Does anyone have any actionscript to remove and/or add icons to the dock? That would be very helpful.

Thanks!

Desmond

(imported comment written by SystemAdmin)

Here is a section of actionscript I use to create icons for Office 2011 in all user’s docks.

You should also check out dockutil. We’re checking into using dockutil for icon manipulation in the future.

http://code.google.com/p/dockutil/

// add icons to the dock delete __createfile createfile until __EOF #!/bin/sh   cd /Users/  

for each in * 

do sudo -u $each defaults write  /Users/$each/Library/Preferences/com.apple.dock persistent-apps -array-add 
'<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Office 2011/Microsoft Word.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' sudo -u $each defaults write  /Users/$each/Library/Preferences/com.apple.dock persistent-apps -array-add 
'<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Office 2011/Microsoft Excel.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' sudo -u $each defaults write  /Users/$each/Library/Preferences/com.apple.dock persistent-apps -array-add 
'<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Microsoft Office 2011/Microsoft Powerpoint.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' done   sleep 2   killall Dock   __EOF   delete 
"/tmp/office2011icons.sh" copy __createfile 
"/tmp/office2011icons.sh" wait /bin/sh 
"/tmp/office2011icons.sh" delete 
"/tmp/office2011icons.sh"

(imported comment written by dsalima91)

Wow! amelgares you’re a life saver. I’ll give it a try and let you know how it goes!

Cheers,

Desmond

(imported comment written by pdentremont91)

Thanks amelgales,

This is great. I have a different problem. I need to be able to remove an item from the dock even though I won’t know where it is in the array. Do you have a solution for this?

Thanks,

Peter d’Entremont

I need to drop an icon from /private/var/tmp to use’s dock. Will this work? I am kinda new to scripting so any guidance would be appreciated.

Thanks for help,
Rich