Script to add share to sidebar in Finder

I have a windows share that mounts at login just fine. It shows up in the dock and in the ‘computer’ window in finder. I can drag it to the sidebar under Devices and it stays. When i reboot though, it’s not there. Can I script finder to automatically add it to the devices sidebar on login?

Hi,

I’m afraid this is not possible with plain AppleScript.

Maybe you could save a com.apple.sidebar.plist including the shares,
then close all Finder windows, mount the drives and replace the com.apple.sidebar.plist with your saved one.

I don’t know, whether this works. Just a thought

Couldn’t get that to work. Any changes I make to the file aren’t applied until I reboot.

I could get Automator to do it using UI scripting but I’d like it to do it in the background.