How to launch an application after a specific Disc was mounted using Automator I'm newbie in Automator. There are many examples for simple actions.

But I could not 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?
Elaborating on ShooTerKo's answer on Stack Overflow (the one Volodymyr Kulyk links to) I've written the following script that continues the Workflow if the triggeringVolumeName is found. That way the actual launch (or any other Workflow action) can be moved outside the Applescript:


Create a new Automator action of type Folder Action
Choose the Volumes folder of your system as input by clicking Other... in the Choose folder dropdown, pressing Cmd+Shift+G and typing /Volumes
As first action choose Execute Applescript
Use the following script and change YOUR_VOLUME_NAME to match your needs:

on run {input, parameters}

    -- define the volume name and the application to start
    set triggeringVolumeName to "YOUR_VOLUME_NAME"

    -- 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

            -- continue workflow
            return input

        end if

    end repeat

    -- if repeat finished without match, cancel workflow
    error number -128

end run

Add other actions to the Workflow, e.g. Ask for Confirmation, Copy Finder Items or Launch Application