at least using sub folder easily
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
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 ) )
}
--------------
Maa,
If you don't want the file name, and want to avoid JS, then the 'path' message to [thispatcher] will do the trick:
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
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
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
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