at least using sub folder easily


    Mar 25 2011 | 9:53 pm
    Ben gave me this
    save as myLocation.js: --------------------------- autowatch = 1;
    function bang() { outlet(0, this.patcher.filepath) } ---------------------------
    which help me a lot but i want to strip the file name
    I don't want to learn Java or Java script now (Max is enough) I am sure this is simple for somebody who know
    Thanks Maa

    • Mar 26 2011 | 12:04 am
      this is auto answer too
      save as myLocation.js: ______________________ autowatch = 1;
      function getFileDirectory( str ) { if( str.toString().indexOf("/") != -1 ) { return str.substring( 0, str.toString().lastIndexOf( '/' ) ); } return str; }
      function bang() { outlet( 0, getFileDirectory( this.patcher.filepath ) ) } --------------
    • Mar 26 2011 | 3:13 am
      Maa,
      If you don't want the file name, and want to avoid JS, then the 'path' message to [thispatcher] will do the trick:
    • Mar 26 2011 | 6:06 am
      what the best one in your opinion js or [thispatcher] ? does it work (in both case) in case of runtime ?
      in fact U am trying to understand this patch triggered at init
      Ben one more time Thanks
    • Mar 28 2011 | 4:32 pm
      I think either strategy would be fine in runtime. I guess if you can get away without using JS, then that is one less dependency to have to worry about.
      -Ben
    • Mar 30 2011 | 1:07 am
      here a solution to strip folder or file name with no JS I am sure it could be better ( I just adapted a post )
      but Ben could you comment the previous one I am sure it would be very useful to others
      Thanks Maa
    • Mar 30 2011 | 5:36 am
      Hello Maa,
      I've simplified the previous patch. I use it to test wether we're in "MaxMSP", in "MaxMSP Runtime" or in a standalone application.
      It just asks for "apppath", if this apppath startstwith "Max5" { we're in Max or in Max Runtime, so we ask for the patcher path, } else { this apppath is a good place to start looking for soundfiles, presets.... }
      léo