jsui with image file in standalone application

Feb 16, 2009 at 12:58am

jsui with image file in standalone application

I’m trying to use jsui to create and control a knob in a standalone application. The knob is an image file (knobmaster.pct) and works fine in the maxpatch. When I build the application, though, I just get a blank box where the knob should be. The function of the knob still works–I can click and drag on the empty box and get the right data–but there’s no knob image. If I open the max window during the build, it shows that the knob image is included. However, if I open the max window in the built application, it says: “sketch_image: knobmaster.pct error -1409 opening file.”

If I use the absolute path to the image, it will work in the app, but only on the computer that the app was built on. On a whim, I also tried building an app out of the jsui help file and got the exact same result. all of the jsui objects work *except* the one that contains the image file–it’s just a blank rectangle.

I’ve tried adding the image file to the build script, and adding the file name as a jsargument in the jsui object, but I can’t get it to work. What’s the secret to using an image file with jsui in a standalone? Any tips, ideas, suggestions? Thanks.

#42320
Feb 16, 2009 at 1:36am

You need to include the picture in the support folder of your standalone. This folder is automatically added to the search path of your application. That way you can easily load the picture by using it’s name in your js code.

HTH,

#151467
Feb 16, 2009 at 1:44am

Ah, thank you! Do I need to create the support folder and then add it to the build script, or do I use the one in ~/Library/Application Support/Cycling ’74?

#151468
Feb 16, 2009 at 2:19am

There’s a support folder created inside the application’s Package (yourApplication.app/Contents/support). Just drop everything there, that way you don’t have anything to install on each computer.

#151469
Feb 16, 2009 at 4:08am

I’ve added the file to the support folder like you describe, but the app still doesn’t see it. Should the js call just the file name (knobmaster.pct), or the path (Contents/support/knobmaster.pct)? Sorry to be so dense. Is there a way to have it automatically added to the support folder, or do I need to re-add it every time I build the app?

#151470
Feb 16, 2009 at 9:57am

An interesting development… My image file was named knobmaster.pct and the call in the js file was also for knobmaster.pct. However, changing the suffix in both cases to .pict did the trick. Apparently jsui doesn’t like .pct files.

I’ve also discovered that rebuilding the app doesn’t completely rewrite the the .app, so disregard my question about having to reinstall the various files. I’ve done a lot of patches and collectives before, but this is my first time dabbling in building an application. Thanks for your help!

#151471

You must be logged in to reply to this topic.