• 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
Re: scripting for the Dock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scripting for the Dock


  • Subject: Re: scripting for the Dock
  • From: Luther Fuller <email@hidden>
  • Date: Thu, 22 Sep 2011 17:08:48 -0500

On Sep 22, 2011, at 4:50 PM, Cuilla Bob wrote:
I would like a simple script that does the same as dragging my d"download folder" onto the dock.  I cant seem to find anything about the dock.  Am I missing something basic?

Here's a handler that I use to install a folder into the Dock as a menu ...

on addDockMenu(folderAlias)
-- 1 construct the |file-data| record
set folderPath to (POSIX path of (folderAlias as text))
if (last character of folderPath) = "/" then
set folderPath to (text 1 thru -2 of folderPath)
end if
set newFileData to {|_CFURLString|:folderPath, |_CFURLStringType|:0}


--2 construct the |tile-data| record
tell application "Finder" to name of folderAlias
set newTileData to {arrangement:0, displayas:1, |file-data|:newFileData, |file-label|:the result, |file-type|:2, showas:3}


-- 3 construct the newMenuFolderItem record
set newMenuFolderItem to {|tile-data|:newTileData, |tile-type|:"directory-tile"}


-- 4 write to Dock preference file
set prefsFile to (((path to preferences from user domain) as text) & "com.apple.dock.plist") as alias
tell application "System Events"
set dockPath to (prefsFile as text)
set dockRec to (value of property list file dockPath)
set |persistent-others| of dockRec to ((|persistent-others| of dockRec) & {newMenuFolderItem})
set (value of property list file dockPath) to dockRec
end tell
tell application "Dock" to quit
end addDockMenu -----------------------------

It works in both Snow Leopard and Lion. If you need different options, you will have to reverse engineer the com.apple.dock.plist preference file.

 _______________________________________________
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

References: 
 >scripting for the Dock (From: Cuilla Bob <email@hidden>)

  • Prev by Date: scripting for the Dock
  • Next by Date: Re: Scripting Xcode 4.1
  • Previous by thread: scripting for the Dock
  • Next by thread: InDesign to PDF script needs to stop if overset text
  • Index(es):
    • Date
    • Thread