2

I've built a Mac App and I want to add a shortcut to it within the favorites section of Finder on install. I do see other Apps achieving the same thing (such as AirDrop). How do I do this?

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

You can do it by appleScript, however this is not the best way.(If cmd+t is changed to someother function, this will fail)

tell application "Finder"
    activate
    -- Select the path you want on the sidebar in the Finder
    select folder "Preferences" of folder "Library" of (path to home folder)
    tell application "System Events"
        -- Command-T adds the Documents Folder to the sidebar
        keystroke "t" using command down
    end tell
end tell

Also, you can add an item by using LSSharedFileList.

Anoop Vaidya
  • 46,283
  • 15
  • 111
  • 140
  • THanks, this is useful but this is just adding a folder. not adding an external drive which is what I am after (sorry was not clear on that i the original post). – user1970393 Mar 21 '13 at 09:34