Javascript API in standalone (OS X)

tom_mudd's icon

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

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's icon

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

tom_mudd's icon

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);
}

Max Patch
Copy patch and select New From Clipboard in Max.

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

Lee's icon

will check it out in morning....