I would like to create an Automator action that will load an external Automator action based on a portion of a filename, on folder drag.

For example:


Type 1 - 3 will run a specified automator tailored for that file. Is this at all possible?

  • 1
    Is it always going to follow the pattern of containing a bracket then the word type then a number then a bracket? Jul 16, 2018 at 22:14
  • Why not just contain all the Automator scripts in one? Why\ does it need to load an external one?
    – JMY1000
    Jul 17, 2018 at 1:05
  • @Jbis Not necessarily. There may be additional suffixes and strings within the filename depending on the situation.
    – Justin Kok
    Jul 17, 2018 at 13:11
  • @JustinKok So what will be the format. Jul 17, 2018 at 13:13
  • 1
    IMO Your question, as is, is poorly written! It is not totally clear what it is you're trying to accomplish. Automator has no way of performing an action based solely on "folder drag". If you are actually referring to dragging and dropping Finder items onto an Automator application, then you should clearly and plainly state this. You should also include real world examples of the before and after of what you're trying to accomplish as well as showing what Automator actions are already involved! Jul 17, 2018 at 14:39

1 Answer 1


Save the following script as an application. Copy and paste into Script Editor (not automator):

on open myItems
    set ds to {"file1", "file2", "file3"} # Enter identifiyers
    set scriptlocation to {"dothis.app", "imeanthis.app", "PleaseUpvoteMy.app} # Enter scripts location as POSIX path, respectivly
    repeat with myItem in myItems
        tell application "Finder"
            set theName to the name of (myItems as alias)
        end tell
        set rptvly to getIndex of theName of ds
        do shell script "open " & the quoted form of rptvly
    end repeat
end open

to getIndex of i from l
    repeat with n from 1 to count l
        if (i as string) contains ((l's item n) as string) then return n
    end repeat
end getIndex

Comment any errors as I am on Mojave beta and having issue where I cannot run sccripts

  • LMAO... "PleaseUpvoteMy.app" . ... Brilliant Absolutely Brilliant
    – wch1zpink
    Jul 17, 2018 at 19:06
  • @wch1zpink :) :) Jul 17, 2018 at 19:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .