• 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: Install in Dock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Install in Dock


  • Subject: Re: Install in Dock
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 5 Nov 2008 09:12:31 -0600

On Nov 2, 2008, at 7:04 PM, I wrote:
Two recommendations to Apple:
1. Simplify the Dock. Folder menus should be the default behavior.
2. Make the Dock scriptable. I should be able, via an AppleScript, to put a folder into the Dock and set its behavior to Display as Folder and View contents as List.

This handler will do item 2 ...

on newDockMenuFolder(folderAlias)
tell application "Finder" to if (class of item folderAlias) is not folder then return


-- 1 construct the |file-data| record
set folderPath to (POSIX path of folderAlias)
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 (POSIX path of prefsFile)
set dockRec to (value of property list file dockPath)
(|persistent-others| of dockRec) & {newMenuFolderItem}
set |persistent-others| of dockRec to the result
set (value of property list file dockPath) to dockRec
end tell
delay 1
tell application "Dock" to quit -- calculate missing data
end newDockMenuFolder -----------------------------

Note: The trick to getting this to work correctly was to omit data items whose value is unknown.
These items are: GUID, directory, _CFURLAliasData, file-mod-date and parent-mod-date.
The Dock will calculate and insert these values when it relaunches.

It took me a couple of days to reverse engineer this. I haven't found any document explaining the meaning of any of the data items. If anyone knows of a document, please let me know.

It's now Apple's turn to do item 1.

 _______________________________________________
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: Install in Dock
      • From: AndrĂ© Berg <email@hidden>
References: 
 >Install in Dock (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: How can I format an integer ?
  • Next by Date: Line spacing in Appleworks
  • Previous by thread: Install in Dock
  • Next by thread: Re: Install in Dock
  • Index(es):
    • Date
    • Thread