Add an item to the Finder/Save dialog sidebar

后端 未结 2 833
逝去的感伤
逝去的感伤 2021-01-03 16:27

I\'m working on a script where a user logs into a guest account on OS and is prompted for their network credentials in order to mount their network home folder (while they b

相关标签:
2条回答
  • 2021-01-03 17:05

    It is possible to do this using AppleScript or Cocoa APIs, or do I need to modify a plist and restart the Finder?

    No.

    As I said on that other question, the correct way to add an item to the sidebar is to use LSSharedFileList.

    0 讨论(0)
  • 2021-01-03 17:16

    A co-worker came up with this method that uses applescript:

    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
    
    0 讨论(0)
提交回复
热议问题