1

Let's say I want to open pictures from those specific folders with Photoshop by default (with double-clicking the file):

/Users/bob/Project1/
/Users/bob/Project3/

And to open pictures with Preview by default in any other location.

I'm not aware of any solution out of the box. Maybe someone has an idea about it?

1

You could build a partial solution with using Hazel and Automator.

1st, create an Automator workflow that uses the "Set Application for Files" action on received files to Photoshop.

2nd, create a Hazel rule that runs that Automator script on any images dropped into a specific folder. You could skip Hazel and just create a folder action in Automator but that would fire on any file placed in that folder and that might not be what you want.

Files modified in such a way would still open in Photoshop once removed from that folder, which is why this is only a partial solution.

  • Thank you for your great insights. I upvote this. It got me on the right track with a solution using Automator to create a shell script application. I'll add it here for reference. – Yoric Jan 31 at 12:05
0

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

Automator

  • This would definitely do it! Sorry, thought you were looking for an automated solution. – Craig Stodolenak Feb 1 at 17:47

You must log in to answer this question.

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