Based on Craig's answer, I found this very similar question that has a great solution using a bash script.
It works surprisingly well, at least for my needs.
The script is wrapped into an application, then the trick is to set up all the jpg
files (for example) to be open with this application by default.
This setup is easily done with the "Get Info" --> "Open with" --> "Change all" steps.
#!/bin/bash
for f in "$@"
do
if [ $(dirname "$f") = "/Users/bob/Desktop" ]
then
open -a "/Applications/VLC.app" "$f"
else
open -a "/Applications/IINA.app" "$f"
fi
done
(As you can notice, this script switch between the two players VLC
and INNA
, but you can easily modify it to switch between Photoshop
and Preview
. The folders can also can be easily modified to /Users/bob/Project1/
and /Users/bob/Project3/
instead of /Users/bob/Desktop
)
Automator is actually not needed, as it's possible to turn a bash script into an application from the Terminal.
Still, if one prefer using Automator, it looks like this (from there you just run "File --> export" and save your application):
