Javascript API in standalone (OS X)

Jul 19, 2013 at 10:46am

Javascript API in standalone (OS X)

Hello,
I’m having trouble getting javascript scripting to work in a standalone – it is giving an error that ‘this.patcher’ is undefined.

I’ve tried following advice here:

http://www.cycling74.com/docs/max5/tutorials/jit-tut/jitterappendixd.html

but I don’t seem to have the recommended file anywhere (JSRefThreadsafe.shlb).

Any suggestions? Or might I have missed something more fundamental? Everything works fine as a patch.

Tom

#256500
Jul 20, 2013 at 1:38pm

post patch? or a small bit of it that shows the issue?

#256591
Jul 20, 2013 at 2:04pm

The problem seems more specific than I had originally thought. It might have been because I was putting the js manually inside the app package.

I’m still getting some problems from the app though. The example attached works fine in the patch, but doesn’t create the nsliders in the .app version (nslider: no such object). Javascript example test.js is pasted below followed by Max patch (can you embed js?).

var blankObj = new Array();
objCount = 0;
var num = this.patcher.getnamed(“testNum”);

function bang() {
num.set(Math.random() * 100);
}

function createObj() {
blankObj[objCount] = this.patcher.newdefault(10 + (objCount * 100), 10, “nslider”);
objCount++;
}

<code>

– Pasted Max Patch, click to expand. –

</code>

#256592
Jul 20, 2013 at 3:45pm

will check it out in morning….

#256594

You must be logged in to reply to this topic.