• 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: Messing with the dock.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Messing with the dock.


  • Subject: Re: Messing with the dock.
  • From: Luther Fuller <email@hidden>
  • Date: Mon, 13 Sep 2010 16:46:54 -0500

I have just modified my previous addDockMenu(folderAlias) so that it will add a application to the Dock.
Perhaps someone will find it useful. It worked both times I tested it. (Will your results vary?)

Here's the script ...

on open dropList
if (count items of dropList) > 1 then
beep
delay 1
return
end if
set applAlias to (item 1 of dropList) as alias
tell application "Finder"
if (class of item applAlias) is not application file then
beep
delay 1
return
end if
end tell
my addApplDock(applAlias)
end open -------------------------------------

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


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


-- 3 construct the newApplicationItem record
set newApplicationItem to {|tile-data|:newTileData, |tile-type|:"file-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-apps| of dockRec to ((|persistent-apps| of dockRec) & {newApplicationItem})
set (value of property list file dockPath) to dockRec
end tell
tell application "Dock" to quit
end addApplDock ------------------------------

 _______________________________________________
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: 
 >Messing with the dock. (From: email@hidden)

  • Prev by Date: Re: Getting the maximum value and minimal values in a list
  • Next by Date: Re: Getting file suffix
  • Previous by thread: Re: Messing with the dock.
  • Next by thread: How can I differentiate a jump drive folder from a HD folder of the same name?
  • Index(es):
    • Date
    • Thread