Topic: Simple batch export script for windows users
Hi everyone,
I use Pianoteq PLAY to export dozens (and dozens) of piano improvisations that I record on a daily basis from my digital piano.
Since Pianoteq does not have batch export, I looked into writing a simple visual basic script to perform batch export. It uses the file open and the export functions. I could not get ctrl to work, so I changed the default key combinations to simply O and E. Here's the script once I changed the key combinations:
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("files.txt", ForReading)
set a=createobject("wscript.shell")
a.run("pianoteq")
wscript.sleep 10000
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.Readline
a.sendkeys "o"
a.sendkeys strNextLine
a.sendkeys "{ENTER}"
a.sendkeys "e"
a.sendkeys "{TAB}"
a.sendkeys "{TAB}"
a.sendkeys "{TAB}"
a.sendkeys "{TAB}"
a.sendkeys "{TAB}"
a.sendkeys "{ENTER}"
wscript.sleep 60000
Loop
Just put the above into a file called export.vbs. In Windows, you can double click such a file to cause it to execute. This script must have a file called "files.txt" in the same directory spelling out absolute paths to each midi file you wish to export. To create such a file, I usually use ls -1. I'm not sure how I'd do that in windows actually I use cygwin on top of windows...
sample files.txt:
"C:\organize\recordings\midi\2011\2011 August 01 01.MID"
"C:\organize\recordings\midi\2011\2011 August 01 02.MID"
"C:\organize\recordings\midi\2011\2011 August 03 02.MID"
"C:\organize\recordings\midi\2011\2011 August 08 01.MID"
Anyway---the script is not very robust and needs a "worst case" wait time for each export. It is what I could do in the space of a couple of hours without really knowing vbscript very well. But, for my purposes it works great. Once I have a few dozen (or hundred) midi files I want to export to wav, I just get a list of the files and set this script running and by morning I have a huge pile of exported WAV files.
To cancel a script in windows, you must ctrl+alt+delete into the task manager and kill the wscript process.
Hopefully that ends up useful to somebody! Maybe there's already a better solution similar to this on this forum, I hadn't found one when I searched, though.