Forums > Javascript

Javascript API in standalone (OS X)

July 19, 2013 | 10:46 am

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



Lee
July 20, 2013 | 1:38 pm

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


July 20, 2013 | 2:04 pm

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>



Lee
July 20, 2013 | 3:45 pm

will check it out in morning….


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