I'm new to Automator.
There are many examples for simple actions.
But I couldn't find examples or documentation for launching some applications after a specific disk was mounted.
It will be very useful at work.
Has someone done this?
Ok, you want the Automator way, you get it :-D
Go to folder
and type /Volumes
Use the following script and define the first two variables to match your needs:
on run {input, parameters}
-- define the volume name and the application to start
set triggeringVolumeName to "YOUR_VOLUME_NAME"
set applicationToStart to application "Microsoft Word"
-- walk through all newly mounted volumes
repeat with aMountedVolumeAlias in input
-- get the volume name from the given alias
tell application "System Events" to set mountedVolumeName to name of aMountedVolumeAlias
-- compare the volume name with the defined trigger name
if mountedVolumeName is triggeringVolumeName then
-- launch the target application
launch applicationToStart
-- all is done stop checking
exit repeat
end if
end repeat
return input
end run
The trick is to watch for changes inside the default mount point of your system (/Volumes
). Everytime something is added to the folder, the AppleScript will be executed and aliases of the newly added items (aka the new volumes) will be inside the input
parameter given to the script.
We walk through the list of all item aliases and get the real name of the alias, compare it with our trigger name and in case of a match we start the application.
Have fun with Automator, Michael / Hamburg