Scripting problem adding markers in Montage workspace

Hello All

I’m trying to add generic markers in a Montage workspace using the Scripting environment (which is great, thanks PG).

The below is a simplified example hacked together from the examples in the pdf manual, and extended a little from the ECMAscript guidleines.

The script works perfectly in an Audio workspace, but when executed in a Montage workspace fails at the line:
activeWave.setCursorPosition(nextCursorPosition * activeWave.sampleRate() );
with the error: Error at line [line Num]: ReferenceError: Can’t find variable: activeWave

Any help or suggestions most appreciated!



//clear the log window

// Array of arrays of marker data (time, info)
var timeArr = new Array(
new Array( 0, “w”),
new Array( 0.5, “x”),
new Array( 1.0, “y”),
new Array( 1.25, “x” )

//loop through and add a markers
for (i = 1; i <= 4; i++) {
var data = timeArr.shift(); // bring forward next data array
var nextCursorPosition = data.shift(); //work out next cursor time
var info = data.shift(); // some info
var comment = nextCursorPosition + ", info: "+ info;
logWindow.printInfo(comment); // print to log window
// problem:
activeWave.setCursorPosition(nextCursorPosition * activeWave.sampleRate() );
activeWave.addMarker(generic, i, comment);


To follow-up on my own post:

simplest Script version that also fails in Montage workspace below.

What am I doing incorrectly?



var sr = activeWave.sampleRate();
activeWave.setCursorPosition(0.5 * sr);
activeWave.addMarker(generic, “mrk”, “hello”);

Replace ‘activeWave’ with ‘activeMontage’ :wink:

Thanks PG

I hoped it was something that simple. But I note that there’s no mention of ‘activeMontage’ in the Section 4.9 Scripting of the ‘Getting into the details’ WaveLab 7 manual , so trust that can be added at some stage.

Thanks again for your prompt support.