一个项目添加到Finder /保存对话框侧边栏 [英] Add an item to the Finder/Save dialog sidebar
问题描述
我的工作,其中在OS用户登录到来宾帐户,并提示输入其网络凭据以安装其网络主文件夹(而他们从本地用户文件夹的工作中获益)的脚本。
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 benefit from working on a local user folder).
作为来宾文件夹被删除,当用户注销时,我想从储蓄那里东西阻止他们。我想,以取代上查找和打开/保存侧边栏列表中的项目(如桌面,用户名,文档等),与那些将保存到他们的网络主文件夹。
As the guest folder is deleted when users log out, I want to discourage them from saving anything there. I would like to replace the items on the Finder and Open/Save sidebar lists (such as "Desktop", username, "Documents", etc) with ones that would save into their network home folder.
有可能做到这一点使用AppleScript或可可的API,或是否需要修改的plist并重新启动搜索? [确认。展望〜/库/ preferences / com.apple.sidebars.plist,这是根本不清楚我是怎么想填充它。]
It is possible to do this using AppleScript or Cocoa APIs, or do I need to modify a plist and restart the Finder? [Ack. Looking into ~/Library/Preferences/com.apple.sidebars.plist, it isn't at all clear how I'd populate it.]
类似的问题:
<一个href=\"http://stackoverflow.com/questions/375323/applescript-adding-mounted-folder-to-finder-sidebar\">AppleScript:将安装文件夹复制到Finder边栏?
- 建议使用fstab文件;这code将最有可能运行作为用户和真正的,在这一点上挂载会为时已晚。
<一个href=\"http://stackoverflow.com/questions/1062856/how-do-you-programmatically-put-folder-icons-on-the-finder-sidebar-given-that-yo\">How你把编程文件夹图标在Finder工具,因为你必须使用自定义图标文件夹?
- 说,没有可可的API,但你可以使用碳风格LSSharedFileList的API,仅在一个头文件中。
- 有谁知道一些例如code的一个项目添加到Finder边栏?
推荐答案
一个同事用这种方法使用AppleScript的上前:
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
这篇关于一个项目添加到Finder /保存对话框侧边栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!