Open a file in a standalone


    Jan 18 2006 | 10:34 pm
    Hi List,
    How can I do this (looking like a) simple thing:
    A user double clic on a file created by MyApp (MyApp is a standalone,
    created by maxmsp), and the file opens in MyApp?
    Thank you,
    --
    Eric L.

    • Jan 18 2006 | 11:22 pm
      If you're on os x, it's pretty easy.
      You have to declare the document types you want to handle in the
      Info.plist file in your MyApp's bundle contents directory:
      To edit this file, you right-click (or control-click) on your app, and
      select "Show Package Contents", open the Contents directory, and edit
      Info.plist in TextEdit.
      Consider storing a backup of this file so you can just drop it into a
      new app each time you build it with Max.
      Take a look at preview.app for a good example.
      http://developer.apple.com/documentation/Cocoa/Conceptual/Do cuments/index.html?http://developer.apple.com/documentation/ Cocoa/Conceptual/Documents/Concepts/DocTypePList.html
      _Mark
    • Jan 18 2006 | 11:25 pm
      Check out the "opened" object.
      I'm not sure if there is a help file for it, but there have been discussions about it on list/forums - search the archives and you'll find all kinds of useful information on it.
      - DL
    • Jan 19 2006 | 12:11 am
      ???
      I can't find this "opened" object anywhere.
      --
      Eric L.
    • Jan 19 2006 | 12:44 am
      Oh, yeah of course you have to handle the "odoc" apple event and do
      the right thing with the path you're given.
      There is an "odoc" object written for os 9 on maxobjects.com, anybody
      feel like porting this?
      _Mark
    • Jan 19 2006 | 12:53 am
      I don't have my iLok handy so I can't try it myself, but I'm pretty sure that's the name of the object.. it's a standard object, but unsupported (hence no help file).
      A quick search of the C74 mailing list / forums brings up this thread which mentions the object though:
      ((sorry for some reason the forums keep displaying this address wrong!! it's adding an extra space))
      I've definitely seen it mentioned further back on the list as well..
      - DL
    • Jan 19 2006 | 12:59 am
      Well...
      I'm on OSX.
      I know about info.plist but...
      When I double-clic on MyFile created by MyApp, it does open MyApp, but
      don't open MyFile in MyApp. Did I missed something?
      i.e: MyFile should be opened by MyColl: how do MyApp knows that MyFile
      has to be opened by MyColl, and not by MyColl2 ?
      Thanks,
      --
      Eric L.
    • Jan 19 2006 | 1:56 am
      That's what the opened object does according to the other post. So
      when you're app gets an 'odoc' apple event, you have to handle it.
      I'm guessing that's what 'opened' does. If not, I'd assume it would
      be not so hard to write an external object that does something like
      this using the carbon event manager api:
      http://developer.apple.com/documentation/AppleScript/Concept ual/AppleEvents/index.html?http://developer.apple.com/docume ntation/AppleScript/Conceptual/AppleEvents/responding_aepg/c hapter_6_section_2.html
      cheers
      _Mark
    • Jan 19 2006 | 10:55 am
      lublin wrote:
      > I'm pretty sure that's the name of the object..
      > it's a standard object, but unsupported (hence no help file).
      This is the help file which is on my system, either from the list, or
      original...
      But it seems to need a bang to report anything, and it seems not to
      report what it supposed to do. (OS X 10.4.4, Max 4.5.6)
      Stefan
      --
      [][] [][][] [][] [][][] [][] [][][] [][] [][][]
      [][][][][][][][][][][][][][][][][][][][][][][][][][][][]
      Stefan Tiedje
      Klanggestalter
      Electronic Composition
      &
      Improvisation
      /~~~~~
      \ /|() ()|
      ))))) )| | |( \
      /// _/)/ )))))
      ___/ ///
      -------------------------x---
      --_____-----------|----------
      --(_|_ ----|-----|-----()---
      -- _|_)----|-----()----------
      ----------()------------x----
      14, Av. Pr. Franklin Roosevelt, 94320 Thiais, France
      Phone at CCMIX +33-1-49 77 51 72
    • Jan 19 2006 | 11:34 am
      I just tested it... and it seems to work (same setup). In fact, you
      won't need to send a bang: when you opened your application while
      double-clicking on your file (or dragging the icon of the file to
      your application's icon), the path is automatically sent to the
      outlet. The only one problem here is about folder which doesn't work
      (while dragging the folder to the application).
      Best,
      ej
    • Jan 19 2006 | 12:17 pm
      Ouuch!
      Chineese, headache.
      Sorry,
      --
      Eric L.
    • Jan 19 2006 | 3:49 pm
      as a tangent to the "opened" object, if you are doing something other than
      .txt, you may want to create another max filetypes file in the "init"
      folder (in the application/support/cycling74/init folder, that is) that
      explicitly adds extention -> filetype mappings. This file will be copied
      to your standalone automatically. Not doing this caused me many
      headaches. Though I don't think they were chinese.
      Also, I said "create another" rather than "edit the default" becuase when
      you upgrade max, the upgrade will probably replace the default, and you
      lose your mappings!
      P.
    • Jan 19 2006 | 3:51 pm
      > Ouuch!
      > Chineese, headache.
      sounds like an MSG, not MSP problem.
      as a tangent to the "opened" object, if you are doing something other than
      .txt, you may want to create another max filetypes file in the "init"
      folder (in the application/support/cycling74/init folder, that is) that
      explicitly adds extention -> filetype mappings. This file will be copied
      to your standalone automatically. Not doing this caused me many
      headaches. Though I don't think they were chinese.
      Also, I said "create another" rather than "edit the default" because when
      you upgrade max, the upgrade will probably replace the default, and you
      lose your mappings!
      P.
    • Jan 25 2006 | 1:45 pm
      I tested again with the help file of opened, it does not put out
      anything just by dropping a standard patch on the application.
    • Jan 25 2006 | 6:48 pm
      Strange, this I just tested again too, with success... same setup...
      Does the application bellow works for you?
      Best,
      ej
    • Jan 25 2006 | 9:26 pm
      Stefan Tiedje wrote:
      > I tested again with the help file of opened, it does not put out
      > anything just by dropping a standard patch on the application.
      Sorry they main part of my last message somehow got cut off:
      I wanted to say if I drop a max patch it won't report anything, but if I
      drop for example a .XML file onto it it will report properly. It just
      seems to ignor native max file types.
      Stefan
      --
      [][] [][][] [][] [][][] [][] [][][] [][] [][][]
      [][][][][][][][][][][][][][][][][][][][][][][][][][][][]
      Stefan Tiedje
      Klanggestalter
      Electronic Composition
      &
      Improvisation
      /~~~~~
      \ /|() ()|
      ))))) )| | |( \
      /// _/)/ )))))
      ___/ ///
      -------------------------x---
      --_____-----------|----------
      --(_|_ ----|-----|-----()---
      -- _|_)----|-----()----------
      ----------()------------x----
      14, Av. Pr. Franklin Roosevelt, 94320 Thiais, France
      Phone at CCMIX +33-1-49 77 51 72
    • Jan 25 2006 | 9:37 pm
      Ok, I get the same behavior. if you drop a patch, the application
      will try to open it...
      ej