• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem Adding an Application to the Dock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem Adding an Application to the Dock


  • Subject: Problem Adding an Application to the Dock
  • From: Dave <email@hidden>
  • Date: Tue, 17 Jun 2008 17:10:23 +0100

Hi All,

I use the following handler to add a file to the dock. This works really well except if the file is already in the dock, it add it again! I'm having trouble figuring out the shell command to remove the file from the dock.

Any help greatly appreciated.

Thanks a lot
All the Best
Dave

------------------------------------------------------------------------
--
--  AddFileToDock
--
------------------------------------------------------------------------

on AddFileToDock(theFilePathNameString)
--display dialog theFilePathNameString


set myShellCommandString to "defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>" & theFilePathNameString & "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'"


do shell script myShellCommandString
do shell script "sh -c \"killall Dock\""
end AddFileToDock
 _______________________________________________
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

  • Follow-Ups:
    • Re: Problem Adding an Application to the Dock
      • From: deivy petrescu <email@hidden>
    • Re: Problem Adding an Application to the Dock
      • From: Laine Lee <email@hidden>
  • Prev by Date: Re: How can I simplify the math in this script?
  • Next by Date: Re: How can I simplify the math in this script?
  • Previous by thread: Re: Will this work?
  • Next by thread: Re: Problem Adding an Application to the Dock
  • Index(es):
    • Date
    • Thread