I am working on a script when a user logs into a guest OS account and asks for their network credentials in order to mount their home home folder (although they can work in the user's local folder).
When the guest folder is deleted, when users log out, I want to dissuade them from saving anything there. I would like to replace the items in the Finder and Open / Save sidebar lists (for example, "Desktop", username, "Documents", etc.) with those that will be saved in the network home folder.
Can this be done using the AppleScript or Cocoa API, or do I need to change the plist and restart the Finder? [Ack. Looking at ~ / Library / Preferences / com.apple.sidebars.plist, itβs not at all clear how I populate it.]
Related questions:
AppleScript: adding an attached folder to the sidebar Finder?
- suggests using fstab; this code is likely to work as a user, and indeed, automation at this point will be too late.
How do you programmatically place folder icons in the Finder sidebar, considering you need to use a custom icon for this folder?
- Says there is no Cocoa API, but you can use the LSSharedFileList API with a carbon interface that is documented in only one header file.
- Does anyone know sample code to add an item to the sidebar Finder?
cocoa applescript finder macos sidebar
Clinton blackmore
source share