WaveLab scripting questions

On Windows (ActiveX), since upgrading to 9.5, the COM Object WaveLabPro9_5.Application is not registered … is there a way to register this?

I am currently looking at this, and there seems to be a registration issue.
I am not a specialist of ActiveX, but maybe you can make use of the tlb file:
C:\Program Files\Steinberg\WaveLab Pro 9.5\Tools\Windows Scripting\WaveLab.tlb

Actually, it works when installing… but you have to run the script from a 64 bit application (like File Explorer, and unlike the file manager I was using).

If you need to register again, you can run this small .bat file:

cd /d "C:\Program Files\Steinberg\WaveLab Pro 9.5"
"C:\Program Files\Steinberg\WaveLab Pro 9.5\WaveLabPro9_5.exe" /regserver

Great thread.

Not a lot of info about Wavelab scripting out there.

May I ask one question?
I’ve noticed you can use firstClip() and nextClip() to cycle through all clips in the montage. Is something similar possible in wave editor? So you could use the loop to run the script on all open files in a File group.

There is a openWave() which can be used for this but as I understand it needs a full path as argument.

I’ve noticed you can use firstClip() and nextClip() to cycle through all clips in the montage. Is something similar possible in wave editor? So you could use the loop to run the script on all open files in a File group.

Not possible. But why not adding it, if you argument me a good use case.

Scripting is supposed to help with repetitive tasks. If you could avoid selecting next audio file open in the editor and running the same script again, it would speed up the workflow even more. Like batch processing with a script.

Thinking about some real life use cases, a lot is already possible with batch processor (trimming, normalising, dc offset,…), but certain things like adding markers, processing a specific range, is not.

Thanks, that’s working now! (needs to be run once, as Administrator). To help those who are getting started, on Windows you can also control WaveLab from PowerShell:

# Hello-64.ps1

$app = New-Object -ComObject WaveLabPro9_5.Application
while (!$app.IsReady())
{
    Start-Sleep -Milliseconds 100
} 
$app.Hello()
$app.Quit()

This does not need to be run as Administrator. Note that the name of the ComObject will vary depending on what version of WaveLab you have – this example is for WaveLab Pro 9.5

Here’s the PowerShell equivalent to convert a wave file to an MP3:

# ConvertToMp3.ps1

$ObjNameApp  = "WaveLabPro9_5.Application" # adjust to your version of WaveLab Pro
$ObjNameWave = "WaveLabPro9_5.Wave"
$fileToConvert = "E:\Audio\Awsome.wav" # the name of the source file
$targetFormat = "%factory%\Encoded\Mp3\Mp3 FH 128k cbr" # the format you want to convert to (preset)

$app = New-Object -ComObject $ObjNameApp
while (!$app.IsReady()) # wait for the application to load
{
    Start-Sleep -Milliseconds 100
} 

$wave = New-Object -ComObject $ObjNameWave # create a new wave editor
$wave.Open($fileToConvert) # load the source file
$wave.SaveAs($fileToConvert,$targetFormat) # convert and save in the target format
$wave.Close()
$app.Quit()

The first two lines may need to be adjusted for your specific version of WaveLab Pro. The next two lines should be self-explanatory – the source file and the format you want to convert it to. The destination file is placed in the same folder as the source file.

Anyone using Visual Studio Code as external script editor for WaveLab?

I’m trying to put together a type declaration file to provide tooltips and auto-complete suggestions for WaveLab specific scripting functions. It’s more the less ready and available here: https://github.com/misohoza/wavelab

I have a few questions that probably only PG can answer:

  • What version of ECMAScript is it? ES5?


  • In documentation examples is a function waitsUntilAllTasksFinished which isn’t documented. Are there more undocumented functions or features?


  • I’m trying to “type” function arguments and return values. I’m not quite sure with clipId and fileId. Is clipId a number and fileId an object?

Thanks in advance.

What version of ECMAScript is it? ES5?

I think this is version 3.
The list of functions independent from WaveLab is there:
https://doc.qt.io/qt-5/ecmascript.html

In documentation examples is a function waitsUntilAllTasksFinished which isn’t documented. Are there more undocumented functions or features?

No. But the number of functions will grow. FY, this script engine is used to test some parts of WaveLab.

I’m trying to “type” function arguments and return values. I’m not quite sure with clipId and fileId. Is clipId a number and fileId an object?

No, just integer IDs.

Philippe

It would definitely useful to be able to run a script on a folder full of files, even if it was adding a script to a batch processor.

I don’t remember for WaveLab 8, but this is indirectly possible in WaveLab 10.
Indeed, it is possible to execute to run an ActiveX script that executes a WaveLab JavaScript. Therefore, if you create an ActiveX script that processes all files of a folder, this is what you are looking for.
BUT, I must say this was never tested, therefore I can’t guarantee it works.
To check if it is possible with WaveLab 8, check the WaveLab documentation for the ActiveX class “InnerScript”.

I’ve got both WaveLab Pro 10 and WaveLab Pro 9.5 installed, and now I want to uninstall WaveLab Pro 9.5 and have my (ActiveX) script call WaveLab Pro 10 instead. Two things:

  1. The example in the documentation in the WLPro10 Tools folder does not work at all:
Set app = CreateObject("WaveLab10_0.Application")

If I change this to

Set app = CreateObject("WaveLabPro10_0.Application")

… it invokes WaveLab Pro 9.5 instead! How can I fix this so that WaveLab Pro 10 is called? I’ve tried:

"C:\Program Files\Steinberg\WaveLab Pro 9.5\WaveLabPro9_5.exe" /unregserver

… followed by:

"C:\Program Files\Steinberg\WaveLab Pro 10.0\WaveLabPro10_0.exe" /regserver

Both execute without error, but WaveLab Pro 9.5 is always invoked when the COM object is created.

Can you try find and remove references of WaveLabPro9_5.exe in the registry?
Note: you can have both WaveLab 9.5 and 10 installed on the same system, for standard use. But for scripting… well I don’t know.

I decided to just uninstall WLPro9.5 as I was going to do that anyway. After that, as expected, ActiveX automation does not work at all. Then, from an admin prompt, I did:

"C:\Program Files\Steinberg\WaveLab Pro 10.0\WaveLabPro10_0.exe" /regserver

… and I can verify that WaveLab Pro 10.0 is registed using this PowerShell that I got here:

Get-ChildItem HKLM:\Software\Classes -ErrorAction SilentlyContinue | Where-Object {
   $_.PSChildName -match '^\w+\.\w+$' -and (Test-Path -Path "$($_.PSPath)\CLSID")
} | Select-Object -ExpandProperty PSChildName | Where-Object {$_ -like 'WaveLabPro*'}

… which list all the COM objects we’re interested in:

WaveLabPro10_0.Application
WaveLabPro10_0.AudioMontage
WaveLabPro10_0.BatchProcess
WaveLabPro10_0.InnerScript
WaveLabPro10_0.KeyShortcut
WaveLabPro10_0.Player
WaveLabPro10_0.Recorder
WaveLabPro10_0.Wave

… but invoking the WaveLabPro10_0.Application object does not work:

$app = New-Object -ComObject WaveLabPro10_0.Application
[...]
Retrieving the COM class factory for component with CLSID 
{A1123938-CAE7-4D98-BC55-C7B4B6ED833A} failed due to the following error: 80040154 Class not registered 
(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

Just out of technical curiosity, now that WaveLab is cross-platform, is ActiveX scripting a cul de sac?

It works here on a recent Windows install with “WaveLab10_0” as reference.
(I run the Hello-64.vbs example script, after changing the name to WaveLab10_0 inside the script).
This ActiveX regristration has always been a mess with Microsoft, and I also met the same experience as you in the past. No idea why.

Just out of technical curiosity, now that WaveLab is cross-platform, is ActiveX scripting a cul de sac?

This is a feature kept, even for future WaveLab version, but no longer enhanced.

Philippe