I wrote an AppleScript to mount an SMB share if it is not already mounted. It also tries 10x on failure with a delay in between. This part is working.
What I really want to do is to run this automatically when the share is disconnected for whatever reason. I thought I could use folder action for this.
My steps:
Then I save it. It saves as a .workflow by default. It does not let me choose a folder so I don't know where it is saved and I can't find it in the finder.
In theory, this should watch /Volumes and when something is removed it should check and mount the smb share if necessary. But nothing seems to happen.
So I changed the watch folder to ~/Downloads and added in some display dialog ... debug print to see if the script is getting triggered at all when I add or remove files from ~/Downloads. But nothing happens. The script is not being triggered.
Anyone knows what I'm doing wrong?
thanks
What I really want to do is to run this automatically when the share is disconnected for whatever reason. I thought I could use folder action for this.
My steps:
- open automator, create folder action
- for "Folder action receives files and folder added to .." select /Volumes as the folder to watch.
- select "Run applescript" from list of actions
- paste in my script, which is now wrapped with
Code:
on removing folder items from this_folder after losing these_items
...
end removing folder items from
Then I save it. It saves as a .workflow by default. It does not let me choose a folder so I don't know where it is saved and I can't find it in the finder.
In theory, this should watch /Volumes and when something is removed it should check and mount the smb share if necessary. But nothing seems to happen.
So I changed the watch folder to ~/Downloads and added in some display dialog ... debug print to see if the script is getting triggered at all when I add or remove files from ~/Downloads. But nothing happens. The script is not being triggered.
Anyone knows what I'm doing wrong?
thanks