Have opening one file trigger opening another fie

Discussion in 'Mac Programming' started by KevWind, Nov 18, 2015.

  1. KevWind, Nov 18, 2015
    Last edited: Nov 18, 2015

    KevWind macrumors member

    KevWind

    Joined:
    Nov 7, 2015
    #1
    I have never used Automator and was told this was possible but have no clue as to how.

    I would like to be able to open a set of two specific related files . Manually open the first file in the set and have that action automatically trigger opening the second file
    Also I have multiple sets of these related files but only need to open one set at a time.

    Both files would be located in the same Parent folder on a second HD in my mid 2010 Mac pro ( not the boot HD)
    I am using Mavericks 10.9.5.

    The first file would be opened by a specific application called Pro Tools
    The second file would be opened by a specific application Reason


    I have tried to do it a number of ways in automator workflow ,service and applications and gone over the help menu several times and search on Youtube and searched on this forum, but can't figure it out.
    Would any body happen to know the best way and a quick step by step suggestion .thanks, Kev
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    Without seeing exactly what you were told about using Automator to accomplish this, I can't comment on whether it's possible or not.

    I don't know of any OS X feature or capability that would do what you ask for, in the way you describe it. There are Folder Actions, where an action occurs due to a Folder change. I know of nothing similar for files, i.e. nothing called File Actions.


    What could be done is to make an Automator workflow that basically contains two actions:
    1. Tell app A to open file Alfa.
    2. Tell app B to open file Bravo.

    The above need not be two actions, it could be a single Run AppleScript action that contains two 'tell' commands. The AppleScript syntax is pretty close to what I've written above. You'd just have to give a specific pathname for each of the files.


    Make a new workflow for every pairing of interest. You could duplicate and modify a prototype workflow, rather than creating each one completely from scratch.

    Put all the workflows into a folder.

    Put the folder containing the workflows in the Dock.

    Click on the folder in the Dock, and choose the workflow for the pair of interest. This will run the workflow, causing the two apps to be told to open the two files.

    Workflows can also be saved as Services. You can then add them to the Services menu, assign them shortcut keys, etc.
     
  3. KevWind thread starter macrumors member

    KevWind

    Joined:
    Nov 7, 2015
    #3
    thanks I'll try it ,Kev
     
  4. KevWind thread starter macrumors member

    KevWind

    Joined:
    Nov 7, 2015
    #4
    This is what I was told... Note he is on a PC but refers to automator script or does he mean apple ?script

    [​IMG]
     
  5. KevWind thread starter macrumors member

    KevWind

    Joined:
    Nov 7, 2015
    #5
    here is what he said a few posts later when asked for more detail again PC

    [​IMG]
     
  6. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #6
    Thanks for the additional info.

    What he describes isn't what you said you wanted to do. His description is just a Windows batch file. It contains commands that open the actual files you want opened. This is functionally the same as creating an Automator workflow with two actions that open the files you want opened.

    In other words, there's still an intermediary file you have to open or run, which then opens the real files of interest. Whether it's a batch file or a workflow file, it still has to be there. There isn't a "trigger" that goes between two files, it's simply a third file with two commands in it.

    Also, if you want to change the pairing of files, you have to edit/change the intermediary. If the type of coupling you originally described existed (a "trigger" from 1st file to 2nd file), then there wouldn't be an intermediary file at all.


    You can do "batch files" or shell files on OS X, too. If you had two files in your home Documents folder, then the commands to open them would be:
    Code:
    open ~/"Documents/File Name Here.extension"
    open ~/"Documents/Other File Here.extension"
    Save it as a plain text file from TextEdit.app, with a .command extension. Then opening it causes it to run in Terminal, which interprets the commands as if you'd typed them in.

    This could also be done as an AppleScript, which you'd edit using AppleScript Editor, and enter the commands that open the files:
    Code:
    tell app "First App Here" to open "path to file here"
    tell app "Second App Here" to open "path to other file"
    Frankly, though, it's simpler to make an Automator workflow that opens the files. There's fewer things to type, so fewer things to type wrong. Basically, Automator exists to simplify the creation of scripted workflows, which you'd otherwise have to type out as Terminal commands or AppleScript commands.


    If you don't know what to do in Automator, then play around with it a little, and see here:
    http://forums.macrumors.com/threads/applescript-or-automator-to-open-specific-file-s.1650084/

    That came up when I googled open file automator

    There are also a lot of Automator tutorials on the web.

    The reason I'm pointing you to resources instead of giving you a complete ready-made workflow is so you can see the breadth of things Automator can do, and learn to use it yourself. Opening two files is pretty elementary, and I think hands-on learning is pretty safe in this case.
     
  7. KevWind thread starter macrumors member

    KevWind

    Joined:
    Nov 7, 2015
    #7
    Hey thanks again I am starting to get it (I think ha) . I'll check out the link
     
  8. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #8
    Good luck!

    If you get stuck, or have a specific question, come back and post it to this thread, with the details of what you're asking about.
     

Share This Page