WaveLab Pro ActiveX Scripting

Introduction

This documentation describes a feature that is only available on Windows.

Application scripting in WaveLab Pro enables you to automate tasks that might otherwise take a long time to perform manually, or to control WaveLab remotely as part of an automated system.

For example, suppose you often have to normalize and convert audio files to MP3 with specific settings… with the appropriate script, all you have to do is to drag and drop the audio file onto the script file: WaveLab Pro is executed and the appropriate sequence of functions is called. Done!

Or suppose you need to automate the recording or playback of files: a couple of script lines and you’re there. You can run scripts that others have written or write your own scripts. You can write scripts in at least two languages: VBScript and JScript.

Learn about these simple languages on Microsoft Web sites. You simply use a text editor to write scripts. There are many references on the internet about VBScript and JScript. If you want to create scripts, you will need to learn the basis of one of these script languages. For more information about Windows Scripting, see: http://en.wikipedia.org/wiki/Windows_Script_Host.

Note: WaveLab has another type of scripts, that execute from WaveLab itself. This is not the topic of this documentation.

To run a script, simply double-click on the script file in the Windows environment (you run script files the same way you run regular executable files).

For certain scripts, drag and drop a file on them.

Alternate method: in the Windows environment, click the Start button, and then click Run. In the Open field of the Run dialog box, type the full path of the script together with some possible arguments (eg. file name), and click OK.

You can find some small script samples in the WaveLabScripting folder. But open them in a text editor to see the comments first, to know what they do.

API details

WaveLab is a “COM Server” and provides an API that can be called by scripts. The following documentation provides a summary of classes and methods exposed by the WaveLab scripting API.

This API is simple by design: few classes, few methods, few arguments, but combining them can create powerful solutions.

Note: WaveLab makes much use of presets throughout the application (eg. File formats, Master Section presets, etc.). The API often refers to these presets. That is, instead of programming many details in scripts, you encapsulate them in the proper presets in WaveLab, then you refers to these presets in the script. To refer to a preset, you simply need to specify its file name, without extension. If the preset file is located in a sub-folder, you specify the relative path, not more. For example:

“mp3-128” or “lossy256” (“lossy” being a sub-folder).

Classes


Application

This class represents WaveLab and its main window.

To properly execute a script, WaveLab needs to be initialized. Therefore, any script should begin with the following code:

Dim app
Set app = CreateObject("WaveLab10_0.Application")
While app.IsReady() = False
    WScript.Sleep(100)
Wend

Functions

Hello ()

Just a way to test a very basic script.

IsReady ()

Checks if WaveLab is ready to execute a script.

Quit ()

Quit WaveLab. If any file is not saved, the standard save dialog pops up.


AudioMontage

Functions

Close ()

The Audio Montage window gets closed.

Open (fileName)

The Audio Montage called filename will be open in a window. If the file is already open, nothing happens.

Play (clipName)

If clipName is an empty string, then the Audio Montage is played from start to end. Else, the specified clip, and only it, is played from start to end.

Render (destFileName, audioFileFormatPresetName, masterSectionPresetName)

The Audio Montage is processed through a chain of plugins, and a wave file is produced with the specified format and under the specified name.


BatchProcess

This class represents a batch processor file.

Functions

AddFile (fileName)

Add a single audio file to the batch.

ClearFileList ()

Remove all files from the batch list.

Close ()

The batch file window gets closed.

Open (fileName)

The batch processor file called filename will be open in a window. If the file is already open, nothing happens.

Run (waitForEnd)

Start the batch processing and optionally waits till the end of it. The method return TRUE if the batch completes and no error has occurred.


InnerScript

This class represents a script internal to WaveLab Pro, that is, not a Windows script.

Functions

Execute (context, scriptFileName)

scriptFileName is the full path to a script file. If the script executes without error, the method returns TRUE.


KeyShortcut

This class represents an executable keyboard shortcut.

Functions

Trigger (context, shortcutAsText)

context is the name of the file type to activate before executing the shortcuts (most shortcuts being dependent on the active file). Since there are also global shortcuts, this value is not mandatory, though recommended.

It can be: * Wave * AudioMontage * Batch * Podcast * BasicAudioCd * DvdAudio * Script

The shortcut string is the textual representation of the shortcut:

for example “Ctrl+O”. Up to four key codes may be entered by separating them with commas, e.g. “Alt+X,Ctrl+S,Q” (as a WaveLab shortcut can be composed of a sequence of 4 key strokes).

Example:

Dim ks
Set ks = CreateObject("WaveLab10_0.KeyShortcut")
Call ks.Trigger("Wave", "Ctrl+C")

Player

Functions

IsNowPlaying ()

Returns TRUE if playback is currently happening.

Stop ()

Stop any playback activity.

WaitEnd ()

The function only returns when the current playback activity reaches its natural end (eg. end of file).


Recorder

This class represents the Recorder window.

Functions

Close ()

End recording and close the window.

Continue ()

Continue recording if and only if current mode is “Pause”.

Discard ()

Discard recording (just like pressing the DISCARD button in the window, but without any warning).

Open (fileName, presetName)

Open the recorder window, and load the specified preset (which can be a null string).

Pause ()

Pause recording (just like pressing the PAUSE button in the window).

Record (fileName)

Start recording the specified file name. Just like pressing the RECORD button in the window. By design, and unlike when using WaveLab Pro directly, there is no message to warn you about a possible file overwriting.

Stop ()

End recording (just like pressing the STOP button in the window).


Wave

This class represents an audio file.

Functions

Close ()

The wave file window gets closed.

Open (fileName)

The wave file called fileName will be open in a window. If the file is already open, nothing happens.

Play ()

The wave file is played from start to end.

Render (destFileName, audioFileFormatPresetName, masterSectionPresetName)

The wave file is processed through a chain of plugins, and saved with the specified format and under the specified name.

SaveAs (fileName, audioFileFormatPresetName)

The wave file is saved under a specific name and with the specified format.