Is it possible to open same file kind in different app according to location?

Discussion in 'macOS' started by Cubytus, Nov 17, 2011.

  1. Cubytus macrumors 65816

    Mar 2, 2007
    Hello MR community,

    I have to read many papers for my thesis, and need to annotate them. So, I installed Skim.

    However, I still want to open the other, non-scientific PDFs in Preview, not Skim, since I don't need all the bell & whistles for them.

    How can I have PDFs located in a given folder (most of my papers are in a folder that's being accessed only through Zotero) open with Skim, while all others would use Preview for that task?

  2. Dave Braine macrumors 68040

    Dave Braine

    Mar 19, 2008
    Warrington, UK
    Select the file, then Right/Ctrl click and choose Open with...
  3. AlanShutko macrumors 6502a

    Jun 2, 2008
    You can't define rules for the finder to open things in different folders in different applications, but what you CAN do is to use a folder action to set the default application for the file to what you want.

    The only issue with this is that if you move the file out of the folder, it won't revert to being opened in preview. But otherwise, it works out well.

    Here's a link to a script that will do it. You'll want to change the list of extensions to "pdf".
  4. interrobang macrumors 6502

    May 25, 2011
    First, find a random PDF. Choose File > Get Info, expand the Open With pane, choose Preview, and click the Change All... button. This will set preview as the default application for viewing general PDFs.

    Next open Automator. Create a new Folder Action. At the top of the action, choose the folder you'll be storing your papers in.
    In the Actions Library on the left, click Files & Folders. Drag "Filter Finder Items" into the workflow. Set the criteria of that action to:

    Find files Where:
    (All) of the following are true
    (Kind) (is) (PDF)

    Then drag the Set Application for Files action into the workflow under your filter. Set the Appplication: to Skim

    That should do it.
  5. Cubytus thread starter macrumors 65816

    Mar 2, 2007
    Hello there,

    the described script doesn't work for already present items. How can I test its proper behavior?
  6. Mal macrumors 603


    Jan 6, 2002
    Drag it somewhere else on the computer, then drag it back into the folder.

  7. Cubytus thread starter macrumors 65816

    Mar 2, 2007

    I tested it in Automator, to no avail. The files are still associated to Preview, even though testing it. In addition, I'm a complete newbie to scripts (written or built with blocks), and thus don't really understand the interface, the actions, intermediate results, error codes...

    I tried to make the script output the result of intermediate operations, including at the beginning of the blocks as the dialog box told me to do, but since I don't understand even the basis of Automator's interface (and there's no intro course available in the Apple Stores), I couldn't get it to spit what was going on.

    Still unsolved :(
  8. interrobang macrumors 6502

    May 25, 2011
    For the ones that you already have, you can just select them, hold down the option key, and choose File > Always open with > Skim. No need for a script if you already have the files.
  9. tiriya macrumors newbie

    Feb 22, 2011
    interrobang's suggestion works. You only use automator, no "direct" involvement with scripting...

    Make sure that in the contextual menu of the folder, under "Folder Actions Setup" the relevant workflow is attached.
  10. Cubytus thread starter macrumors 65816

    Mar 2, 2007
    I changed the existing PDF to open with Skim.

    Instead of testing the script in Automator, which didn't seem to work, I saved it.
    PDF added directly to the root folder are set to open with Skim, but PDF addeed to subfolders are not.

    How can I set them to open with Skim considering that randomly-named folders are created each time an item is added to Zotero?

Share This Page