Add an item to the Finder/Save dialog sidebar
-
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. 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.] Similar Questions: http://stackoverflow.com/questions/375323/applescript-adding-mounted-folder-to-finder-sidebar suggests using fstab; this code will most likely run as a user and really, automounting at that point would be too late. http://stackoverflow.com/questions/1062856/how-do-you-programmatically-put-folder-icons-on-the-finder-sidebar-given-that-yo Says there is no Cocoa API, but that you can use a carbon-style LSSharedFileList API that is only documented in a single header file. Does anyone know of some example code to add an item to the Finder sidebar?
-
Answer:
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.
Clinton Blackmore at Stack Overflow Visit the source
Other answers
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
Clinton Blackmore
Related Q & A:
- how to make sidebar?Best solution by WordPress
- How do I move my sidebar?Best solution by Yahoo! Answers
- How do I find the item number on a ebay item?Best solution by Yahoo! Answers
- How do I add my own item to amazon?Best solution by Yahoo! Answers
- Which is better optical view finder or electronic view finder?Best solution by discoverdigitalphotography.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.