Sound Forge scripting uses the Microsoft .NET framework for scripting. You can write scripts in JScript, Visual Basic .NET, or C#.
-
From the View menu, choose Script Editor if the Script Editor window isn’t already visible.
-
Create a new script template:
a. Click the next to the New Script Template button .
b. Choose the type of script you want to create.
c. Click the New Script Template button .
A new script is displayed in the Script Editor window with everything you need to get started.
-
Replace the /*begin here*/ text with your script.
In the following sample JScript script, the text in green was added to the script template. When run, this script would add information to the Summary window for the active data window. Red text represents information that you would want to customize:
import System;
import System.Windows.Forms;
import SoundForge;
public class EntryPoint {
public function Begin(app : IScriptableApp) {
var file = app.CurrentFile;
if (null != file)
{
var sumy = file.Summary;
for (var fcc in sumy)
{
DPF(“fcc=” + fcc + ” ‘” + sumy.Item(fcc) + “‘”);
}
//MODIFY HERE – type your own information in the area below
sumy.Title = “Title“;
sumy.Subject = “Subject“;
sumy.Engineer = “Engineer“;
sumy.Copyright = “Copyright“;
sumy.Comments = “Comments“;
sumy.CreationDate = “2005-01-05“;
sumy.Genre = “Genre“;
sumy.TrackNo = “TrackNo“;
sumy.Album = “Album“;
sumy.Artist = “Artist“;
}
}
public function FromSoundForge(app : IScriptableApp) { public function DPF(sz,o,o2,o3) { ForgeApp.OutputText(System.String.Format(sz,o,o2,o3)); }
} // class EntryPoint
ForgeApp = app;
app.SetStatusText(String.Format(“Script ‘{0}’ is running.”, Script.Name));
Begin(app);
app.SetStatusText(String.Format(“Script ‘{0}’ is done.”, Script.Name));
}
public var ForgeApp : IScriptableApp = null;
public function DPF(sz) { ForgeApp.OutputText(sz);}
public function DPF(sz,o) { ForgeApp.OutputText(System.String.Format(sz,o)); }
public function DPF(sz,o,o2) { ForgeApp.OutputText(System.String.Format(sz,o,o2)); }
-
Click the Compile Script button to compile and test your script. Any errors are displayed at the bottom of the window.
-
Click the Save button to choose the file name and location you want to use to save the script.
All you need to edit a script is the Script Editor window (and, or course, a working knowledge of JScript, Visual Basic .NET, or C# scripting). The scripts that are included with Sound Forge software are fully commented to help you find and edit the parameters you need.
-
From the View menu, choose Script Editor if the Script Editor window isn’t already visible.
-
Click the Open button in the Script Editor window, choose the script you want to edit, and then click Open.
The contents of the script are displayed in the Script Editor window.
You cannot edit scripts that have been compiled as DLLs.
-
Edit the script as needed. The comments in the script will help you find the parameters you need to edit.
Comments are indicated with double forward slashes: //.
-
Click the Compile Script button to compile and test your edited script. Any errors are displayed at the bottom of the window.
-
Click the Save button to replace the script you edited, or click the Save As button if you want to save the edited script with a different name or in a different location.
Editing or Creating Scripts |
|
Use the Script Editor window to open, create, edit, or run scripts.
You can find the most recent scripting API (application programming interface) and sample scripts on our Web site. For more information about scripting, please check out the scripting forum.
What do you want to do?
Create a script
Edit an existing script