Two Questions on Scripts

  1. Can I assign a keyboard shortcut to run a specific script?

  2. I changed the example script from the dokumentation to create markers with the same length on a Wave (Audio File). It works fine.
    I now want to use the script to do the same to all Clips in an Adiomontage.
    Can somebody please help me changing the code?

//clear the log window
//show some information about the active wave file in the log window
logWindow.printInfo("This wave file has " + activeWave.size() + " samples");
logWindow.printInfo("Its sample rate is " + activeWave.sampleRate());
logWindow.printInfo("It has " + activeWave.numChannels() + " channels");
//Work out how long the file is in seconds and round to a whole number
var lengthSecs = activeWave.size() / activeWave.sampleRate();
var lengthSecsfull = Math.round(lengthSecs);
var lengthMins = (lengthSecsfull / 60);
var countParts = Math.floor(lengthSecs / 40);
var lengthsParts = (lengthMins / countParts);
var lengthsPartsSecs = (lengthSecs / countParts);

logWindow.printInfo("This wave file is " + lengthSecsfull + " seconds long");
logWindow.printInfo("That are " + lengthMins+ " Minutes");
logWindow.printInfo("That are " + countParts+ " Parts");
logWindow.printInfo("The best length for the parts is" + lengthsParts+ " min");

//Marker setzen:

for (i = 1; i <= countParts - 1; i++)
    //work out next cursor time
    var nextCursorPosition = i * lengthsPartsSecs * activeWave.sampleRate();

    //set cursor position forwards by a second

    //add a generic marker at the next cursor position and give it a name and comment
    activeWave.addMarker(generic, "Part" + i, "A comment for marker " + i);

    //write some information about the new marker
    var cursorTimeSecs = nextCursorPosition / activeWave.sampleRate();
    logWindow.printInfo("created a new marker at " + cursorTimeSecs + " seconds");
  1. You can add a shortcut to the Execute command, but not to a given script
  2. I think you can use these functions: firstClip(), nextClip(), clipPosition(), clipSize()