Forums > Javascript

[bugreport] this.patcher.filepath

October 5, 2007 | 10:46 am

this.patcher.filepath only works in a javascript object that is located in the main patcher window. If you place the js object with the same script in a subpatcher, the attribute seems to return an empty string.

I suspect this might be a known issue, but I can’t find it in the archives.

(Windows 4.6.3)

-Thijs


October 7, 2007 | 12:00 pm

this is the same for the thispatcher object itself. it doesn’t
report a filepath from a subpatch.
i think this is expected behavior? frankly, i’ve never liked it,
because it means i can’t hide the thispatcher object in a subpatch.

cheers
evan

On Oct 5, 2007, at 11:46 AM, Thijs Koerselman wrote:

>
> this.patcher.filepath only works in a javascript object that is
> located in the main patcher window. If you place the js object with
> the same script in a subpatcher, the attribute seems to return an
> empty string.
>
> I suspect this might be a known issue, but I can’t find it in the
> archives.
>
> (Windows 4.6.3)
>
> -Thijs
>


October 7, 2007 | 2:51 pm

Quote: thijs.koerselman wrote on Fri, 05 October 2007 12:46
—————————————————-
> this.patcher.filepath only works in a javascript object that is located in the main patcher window. If you place the js object with the same script in a subpatcher, the attribute seems to return an empty string.
>
> I suspect this might be a known issue, but I can’t find it in the archives.
>
> (Windows 4.6.3)
>
> -Thijs
>
—————————————————-

I assume filepath is only available for patchers that are actually saved to disk, i.e. abstractions and top patchers.

To get the file path of the top patcher from inside a subpatcher you need to traverse up until you reach the top patcher and take the filepath property of that one..

Mattijs


October 7, 2007 | 4:38 pm

> To get the file path of the top patcher from inside
> a subpatcher you need to traverse up until you reach
> the top patcher and take the filepath property of that one..

Ah of course. I guess this.patcher.parentpatcher.filepath will work then. I’ll give it a try.

Cheers,
-Thijs


Viewing 4 posts - 1 through 4 (of 4 total)