applescript working with mounted shares
Hey-o,
I am putting together an applescript that will mount a share, work with files on that share, then unmount it when done.
Here is some sanitized code...
set LCD to (mount volume "smb://servername/sharename")
( process files)
tell application "Finder"
eject disk LCD
end tell
This works perfectly when the share is not already mounted when the script runs. If the share is already mounted, it complains about LCD being undefined when the script hits the eject disk command. The language guide says mount volume returns nothing, but ejecting LCD works. I would prefer not to use eject disk "sharename" because there is the possibility of a share with the same name being mounted from a different server.
I tried putting the mount volume into a TRY block, but apparently having the volume already mounted isn't an error condition.
Ideally, what I would like is for LCD to get a disk handle (or whatever applescript calls it) from the new mount OR from the existing mount, which I can then eject.
Is this possible?
Thank you.
Paul Baughman