Tricking OS X into opening a copy of an app per file?

Discussion in 'macOS' started by haravikk, Sep 11, 2010.

  1. haravikk macrumors 65816

    May 1, 2005
    This is related to Flash player, but basically to have multiple files open in Flash Player quickly decimates its performance as it seems to thread extremely poorly.

    However, this can be easily circumvented by either opening files in other programs that use the Flash plugin (such as browsers), or simply copying the Flash Player app a few times and dragging each file onto a different one to open multiple copies.

    Now, while the latter is the better option IMO, it's messy and you need to recreate the copies any time the Flash Player is updated.

    What I'm wondering is if it would instead be possible (perhaps via a script assigned as the .swf file type handler) to open a new copy of Flash Player every time a .swf file is opened, and hand the file to the new copy, instead of simply opening new files in an existing copy.

    Don't suppose anyone has any ideas as to how this would be done? I've wrestled with assigning a script container to a file-type before and it is possible (with a bit of work), but opening a single copy of an app multiple times is something I don't know how to do.
  2. LPZ macrumors 65816

    Jul 11, 2006
    Take a look at the man page for the open command, in particular the -n option.
  3. haravikk thread starter macrumors 65816

    May 1, 2005
    Ah, that did the trick!

    For those interested then, here's the script I used:

    source ~/.profile
    APP="/Applications/Adobe Creative Suite 5/Adobe Flash CS5/Players/Flash Player"
    if test $# = 0
    for f in "$@"
    	open -a "$APP" -n "$f"&
    To get it assigned as a default file-type I added the script into an Automator .app, and then edited the info.plist file, copying across the CFBundleDocumentTypes from the Flash so that it will map onto the same file-types, allowing you to select the Automator .app I created as an intermediary.

    I've attached the little .app I created, it currently points to the CS5 Flash Player, but if you edit the script (open the .wflow file inside the .app, don't use Automator or you'll overwrite all the extra stuff) you can point it to whichever Flash Player you need.

    Anyway, thanks very much for the hint LPZ!

    Attached Files:

Share This Page