• 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: AppleScript-Users Digest, Vol 7, Issue 461
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript-Users Digest, Vol 7, Issue 461


  • Subject: Re: AppleScript-Users Digest, Vol 7, Issue 461
  • From: email@hidden
  • Date: Tue, 14 Sep 2010 09:44:38 -0500

Thanks once again Luther but this script doesn't seem to do anything on my Mac. Where do you insert the name and path of the Application that you want to put in the Dock?








Today's Topics:

  5. Re: Messing with the dock. (Luther Fuller)



----------------------------------------------------------------------

Message: 5
Date: Mon, 13 Sep 2010 16:46:54 -0500
From: Luther Fuller <email@hidden>
Subject: Re: Messing with the dock.
To: Applescript Users <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset="us-ascii"

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

  • Follow-Ups:
    • Re: AppleScript-Users Digest, Vol 7, Issue 461
      • From: Luther Fuller <email@hidden>
  • Prev by Date: Re: Getting file suffix
  • Next by Date: Re: Getting file suffix
  • Previous by thread: Getting into Adobe Reader
  • Next by thread: Re: AppleScript-Users Digest, Vol 7, Issue 461
  • Index(es):
    • Date
    • Thread