Forums > Jitter

jit.matrix read jxf in standalone

May 28, 2014 | 1:49 pm

I’m trying to create an array of jit.matrices that import jxf files and post them to their own videoplanes by generating it all in Javascript. I also want to export it into a standalone.

I can find the appropriate files and how many there are in the folder, but if I read the jxf into a jit_matrix object by passing its filename I get a "jit.matrix can’t find file …" error. It works in the patcher, but if I create a standalone .mxf or .exe I get no response. I’ve tried different pathtypes and styles and running as administrator, but there is something wonky about how jit.matrix reads external files because I CAN manually select the very same jxf file I want via the file selector that comes with the read() function but not passing it as a string or message! Nor does jit.matrix a JXF when I run the patcher from a Runtime window.

I even tried it with Java. Create everything within an mxj but jit.matrix will not read my string-based filenames in a standalone. So annoying. I can’t really buy another copy of Max just because I can’t get this to run on its own!

What is the difference between pathnames in jit.matrix in the runtime vs the patcher?

Max 6.1.7
Windows 7


May 28, 2014 | 11:49 pm

Aleatory, try this solution – works with my projects, should be universal (if you just copied the code to the new patch you have to save your patch to make this solution available):

– Pasted Max Patch, click to expand. –
  • This reply was modified 2 months by  yaniki.
  • This reply was modified 2 months by  yaniki.

May 29, 2014 | 12:12 pm

Thanks Yaniki!
but I’m not having trouble finding the pathname. I know the filepath jit.matrix attempts to read is the one I want because the error jit_matrix throws during the read() function prints it out. There’s something strange about passing a filename to jit_matrix.read(String)

Plus the [;max getapppath ] solution limits me to files within the application folder. I’d prefer to reach files elsewhere on the computer, but even if I put my jxf files in the same folder as the application, jit_matrix gives me the same error. Unless there’s some weirdness about symbol to string conversion or concatenating a string to find subfolders causes the path to be illegitimate.

Have you used this method specifically for reading jxf into jit.matrix in javascript before?


May 29, 2014 | 1:14 pm

> Have you used this method specifically for reading jxf into jit.matrix in javascript before?

Sure!

See attached .zip for more tips ;-) Works as standalone and as a "patch", you may choose the filename (and the pathname), works from js too…


May 29, 2014 | 2:59 pm

I think you forgot the zip file.
But I figured it out anyway!

I used the [;max paths ] message to check what paths were available to my standalone. Lo and behold the attributes @usesearchpath and @searchformissingfiles in the [standalone] object were not really performing as well I as I thought. The .exe was only searching the folders Max generated for it and ignored all my requests to use mine in the Builder includes and dropping it into the folder manually. So I set a search path using [filepath] in the patcher to manually add my top directory to the search paths (after that it was able to search further subfolders). Then jit.matrix was able to read all my JXF files no problem!

I guess it makes it safer that Max doesn’t have access to files even if you tell it exactly where they are, but that was not expected. I’m gonna try this with matrices inside Java too.


May 29, 2014 | 10:29 pm

Strange…

So, I’m attaching the zip again.

Attachments:
  1. loadsave.zip

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