Is there a problem with this script?

Jan 20, 2009 at 4:06am

Is there a problem with this script?

I made a post a few moments ago about a patch blowing up in the main forum, but I’m pretty sure I’ve narrowed it down to a JS script. This runs like a charm on Mac OS X, but kills Max on Windows XP. Am I missing something?

// BEGIN GLOBALS

var p;
var houdiniButton;
var jsBox = this.box;

// END GLOBALS;

function init(){
while(a = this.patcher.getnamed(“houdiniButton”)){
this.patcher.remove(a);
}

houdiniButton = this.patcher.newdefault(0, 0, “ubutton”);
houdiniButton.message(“presentation”, 1);
houdiniButton.message(“presentation_rect”, 182.0, 122.0, 52.0, 25.0);
houdiniButton.message(“patching_rect”, 202.0, 59.0, 52.0, 25.0);
houdiniButton.message(“hltcolor”, 0.0, 0.0, 0.0, 0.0);
houdiniButton.message(“varname”,”houdiniButton”);
this.patcher.bringtofront(houdiniButton);
this.patcher.connect(houdiniButton, 0, jsBox, 0);

}

function bang(){
this.patcher.remove(houdiniButton);

p = new Patcher(100,100,400,400);
p.message(“front”);
p.message(“rect”, 311.0, 279.0, 361.0, 113.0);
p.message(“defrect”, 311.0, 279.0, 361.0, 113.0);
p.message(“bgcolor”, 0.0, 0.0, 0.0, 1.0);
p.message(“presentation”, 1);
p.message(“toolbarvisible”, 0);
p.message(“title”, “Warning”);

pComment = p.newdefault(0, 0, “comment”);
pComment.message(“set”, “Close”);
pComment.message(“frgb”, 0.760784, 0.792157, 0.168627, 1.0);
pComment.message(“fontname”, “Calibri”);
pComment.message(“presentation_rect”, 25.0, 7.130005, 121.0, 19.0);
pComment.message(“fontface”, 1);
pComment.message(“fontsize”, 10.0);
pComment.message(“bgcolor”, 0.760784, 0.792157, 0.168627, 0.0);
pComment.message(“patching_rect”, 25.0, 7.130005, 121.0, 19.0);
pComment.message(“textcolor”, 0.760784, 0.792157, 0.168627, 1.0);
pComment.message(“presentation”, 1);

pComment2 = p.newdefault(0, 0, “comment”);
pComment2.message(“set”, “Changing the number of voices will necessarily rebuild the DSP chain. When this occurs, all settings of existing voices will be cleared. If you have settings in these voices that you would like to save, use Preset Management first to save a preset.”);
pComment2.message(“frgb”, 0.760784, 0.792157, 0.168627, 1.0);
pComment2.message(“fontname”, “Calibri”);
pComment2.message(“presentation_rect”, 12.0, 42.130005, 342.0, 65.0);
pComment2.message(“fontface”, 1);
pComment2.message(“fontsize”, 12.0);
pComment2.message(“bgcolor”, 0.760784, 0.792157, 0.168627, 0.0);
pComment2.message(“patching_rect”, 12.0, 42.130005, 342.0, 65.0);
pComment2.message(“textcolor”, 0.760784, 0.792157, 0.168627, 1.0);
pComment2.message(“presentation”, 1);

pComment3 = p.newdefault(0, 0, “comment”);
pComment3.message(“set”, “Warning”);
pComment3.message(“frgb”, 0.760784, 0.792157, 0.168627, 1.0);
pComment3.message(“fontname”, “Calibri”);
pComment3.message(“presentation_rect”, 131.0, 4.0, 94.0, 36.0);
pComment3.message(“fontface”, 1);
pComment3.message(“fontsize”, 24.0);
pComment3.message(“bgcolor”, 0.760784, 0.792157, 0.168627, 0.0);
pComment3.message(“patching_rect”, 131.0, 4.0, 94.0, 36.0);
pComment3.message(“textcolor”, 0.760784, 0.792157, 0.168627, 1.0);
pComment3.message(“presentation”, 1);

pButton = p.newdefault(0, 0, “button”);
pButton.message(“set”, “Close”);
pButton.message(“fgcolor”, 0.760784, 0.792157, 0.168627, 1.0);
pButton.message(“presentation_rect”, 7.0, 6.0, 20.0, 20.0);
pButton.message(“outlinecolor”, 0.368627, 0.368627, 0.368627, 1.0);
pButton.message(“patching_rect”, 7.0, 6.0, 20.0, 20.0);
pButton.message(“bgcolor”, 0.913725, 0.913725, 0.913725, 0.0);
pButton.message(“presentation”, 1);

pPanel = p.newdefault(0, 0, “panel”);
pPanel.message(“border”, 2);
pPanel.message(“rounded”, 10);
pPanel.message(“bordercolor”, 0.760784, 0.792157, 0.168627, 1.0);
pPanel.message(“presentation_rect”, 0.0, 0.0, 361.0, 113.0);
pPanel.message(“patching_rect”, 0.0, 0.0, 361.0, 113.0);
pPanel.message(“bgcolor”, 0.0, 0.0, 0.0, 1.0);
pPanel.message(“presentation”, 1);

pSend = p.newdefault(0, 40, “s”, “popupJS”);
pSend.hidden = 1;

p.connect(pButton, 0, pSend, 0);

}

function closeP(){
p.message(“wclose”);
popupButton = this.patcher.getnamed(“popupButton”);
this.patcher.disconnect(popupButton, 0, jsBox, 0);
}

function closeWin(){
if(a = this.patcher.getnamed(“houdiniButton”)){
this.patcher.remove(a);
}
}

#41853

You must be logged in to reply to this topic.