Re: Remove icon from dock after adding it
Re: Remove icon from dock after adding it
- Subject: Re: Remove icon from dock after adding it
- From: Laine Lee <email@hidden>
- Date: Thu, 23 Jul 2009 12:21:59 -0500
- Thread-topic: Remove icon from dock after adding it
Title: Re: Remove icon from dock after adding it
On 7/23/09 12:01 PM, "Luther Fuller" <email@hidden> wrote:
> In my experience using System Events is a lot easier than using 'defaults'. To
> remove a Dock item you have to find and delete the item of the list/array
> 'persistent-others' that refers to the Dock tile. A picture is worth a
> thousand words at this point, so ...
>
>
> Obtained using Property List Editor. If you wanted to remove the Dock item
> named "Actions", you would remove item 2 of the list/array
> 'persistent-others'. Of course, you have to know the structure of the items of
> 'persistent-others' in order to search for "Actions".
>
> set prefsFile to (((path to preferences from user domain) as text) &
> "com.apple.dock.plist") as alias
> tell application "System Events"
> prefsFile as text
> set poArray to (value of property list item "persistent-others" of property
> list file the result)
> repeat with i from 1 to (count items of poArray)
> set poItem to item i of poArray
> set tileDataRec to |tile-data| of poItem
> set tileName to |file-label| of tileDataRec
> display dialog tileName
> end repeat
> end tell
>
> I just ran this code ... and it worked!
>
>
Thanks. That's good, but I think it requires Leopard, no? I want to make use of it in Tiger, too. Anyway, I kept looking and also found this (http://forums.macosxhints.com/showthread.php?t=39428):
#!/bin/bash
#read -p "Name of app to remove from Dock is: " theApp
theApp=”Custom Tool”
appspre=`defaults read com.apple.dock persistent-apps`
nl=`echo "x" | tr 'x' '\34'` # what is the proper way to set ascii to a variable?
appspost=`echo -n "$appspre" | sed "s/^[()]$//;s/},/}$nl/" | tr '\n\34' '\00\n'| grep -va "$theApp" | tr '\n\00' ',\n' | sed 's/^,$//'`
defaults write com.apple.dock persistent-apps '($appspost)'
killall Dock
Thanks again.
--
Laine Lee
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden