OSX Standalone File association


    Jan 14 2008 | 7:20 am
    Hi,
    I have made a standalone which uses pattr xml files to store setups. I would like to associate xml files written with my standalone to my app, so that when they are double clicked in the os my app is launched (also they should have their own icon). Can any osx gurus tell me the steps needed to do this or if it is possible? I guess I have to edit the plist.
    cheers,
    oli

    • Jan 14 2008 | 8:40 am
      hi oli,
      this is something i gleaned from michael egger's LiveCut app.
      use the SetFile *nix tool through shell to assign the file your
      filetype and creator-code
      copy the unix binary into the app bundle to be sure it's available. on
      my machine it's located in /usr/bin/ and is universal.
      then run the following shell command to assign for example the
      filetype svg and the creator adobe illustrator
      "/path/to/SetFile" -t svg -c ART5 "/path/to/file/Untitled.svg";
      jeremy bernstein has an external called filetype that also has these
      hth
      /*j
      btw: i like your intlib interpolations!
    • Jan 15 2008 | 8:50 am
      Thanks!
      Now if only i could stop the xml file opening in max's texteditor...
      oli
    • Jan 15 2008 | 9:08 am
      On 15 janv. 08, at 09:50, Oliver Larkin wrote:
      > Thanks!
      >
      > Now if only i could stop the xml file opening in max's texteditor...
      I did an ugly hack once (well... maybe twice;)) for an application: I
      was closing the window via applescript (shell + osascript /
      tap.applescript). Not very elegant, but at least the window disappeared.
      ej
    • Jan 16 2008 | 8:48 am
      hi ej,
      I'm trying to use an applescript but can't seem to get anything to happen. Here's my script...
      osascript -e 'tell application |MaxMSP| to close every window whose name is |hello.txt|'
      I turned on "enable access to assistive devices". Do you have any ideas what is wrong with my script?
      thanks,
      Oli
    • Jan 16 2008 | 10:40 am
      Emmanuel Jourdan schrieb:
      > I did an ugly hack once (well... maybe twice;)) for an application: I
      > was closing the window via applescript (shell + osascript /
      > tap.applescript). Not very elegant, but at least the window disappeared.
      This could be a feature request for Max 5.1 if it isn't addressed
      already: Have a standalone react on opening with certain file types in a
      consistent way...
      I guess this would turn Max much more into a general purpose developing
      platform than it is now...
      Stefan
      --
      Stefan Tiedje------------x-------
      --_____-----------|--------------
      --(_|_ ----|-----|-----()-------
      -- _|_)----|-----()--------------
      ----------()--------www.ccmix.com
    • Jan 16 2008 | 12:03 pm
      On 16 janv. 08, at 09:48, Oliver Larkin wrote:
      > I'm trying to use an applescript but can't seem to get anything to
      > happen. Here's my script...
      >
      > osascript -e 'tell application |MaxMSP| to close every window whose
      > name is |hello.txt|'
      >
      > I turned on "enable access to assistive devices". Do you have any
      > ideas what is wrong with my script?
      I couldn't make this work either. I did that by using System Events
      that way to emulate keyboard shortcuts:
      tell application "YourMaxApp"
      activate
      tell application "System Events"
      keystroke " keystroke "W" using command down
      end tell
      end tell
      Which makes that it use the command+< keyboard shortcut to switch to
      the next window, and command+w to close it.
      ej
    • Jan 16 2008 | 12:18 pm
      thanks, that's great! I needed to change the capital W to lower case e.g.
      tell application "YourApp"
      activate
      tell application "System Events"
      keystroke " keystroke "w" using command down
      end tell
      end tell
    • Jan 16 2008 | 3:03 pm
      On 16 janv. 08, at 11:40, Stefan Tiedje wrote:
      > Emmanuel Jourdan schrieb:
      >> I did an ugly hack once (well... maybe twice;)) for an application:
      >> I was closing the window via applescript (shell + osascript /
      >> tap.applescript). Not very elegant, but at least the window
      >> disappeared.
      >
      > This could be a feature request for Max 5.1 if it isn't addressed
      > already: Have a standalone react on opening with certain file types
      > in a consistent way...
      > I guess this would turn Max much more into a general purpose
      > developing platform than it is now...
      Request registered, no promise though.
      ej
    • Jan 16 2008 | 8:00 pm
      While your at it...Any chance we can have full control over the standalone menu bar in Max 5 too?
      cheers,
      oli
    • Jan 16 2008 | 9:54 pm
      I modified some code from Philippe Gruchet so that the window of the text file that is opened is closed. Not sure if that is safer or not.