Community Forums Archive

Go Back

Subject:External soundforge parameters
Posted by: timaddy
Date:11/17/2006 9:11:07 AM

I am trying to set the directory of my input files when I call soundforge. How can I do this? I use the following which uses /Scripts


"c:\Program Files\Sony\Sound Forge 8.0\Forge80.exe" /Script:"c:\Script.cs"


I wondered if there is there are any /params that can be passed in to soundforge? Can you let me have a list of all of /commands that can be used with Soundforge as this would be really useful.

Best Regards

Tim Addy

Subject:RE: External soundforge parameters
Reply by: _TJ
Date:11/18/2006 3:48:08 PM

Available Commands are petty minimal. But be aware of one caveat -

You cannot use /Script: commands and /Open commands on the same command line. The script commands will try to run sumultaneously with the opens, and "Bad things will happen." (tm). Basically, the results are undefined and crashes and/or hangs are pretty likely.


/Open:<filename>
/Region:<start>,<length>
/NoDefSession
/NoLogo
/Logo
/Script:<script-path?script-args>


/Region modifies a previous /Open command, telling Sound Forge to make a time selection after opening the file. It's used mainly by the "Open in Sound Forge" menu option in Vegas and ACID.

/NoDefSession prevents Sound Forge from automatically opening the files that it had open the last time it closed. This is unnecessary if you are passing an /Open

/Logo forces the logo to display on startup
/NoLogo forces it not to display

and of course, /Script: runs a script. (/RunScript: is also accepted).

The script can be passed arguments in the same way that arguments can be passed in URL's. Use a ? after the filename to separate it from script arguments, multiple arguments are separated by &. Arguments can be named or anonomous. Named arguments are in the form name=value, if there is no equals sign, then the argument is anonomous.

so the script command line:


"/Script:c:\scripts\my script.cs?dir=c:\data\my stuff&count=99&float&Butterfly"

Has 4 arguments, 2 named and 2 anonomous


dir is "c:\data\my stuff"
count is 99
is float
is Butterfly


Scripts can retrieve arguments using the Script.Args object. It has methods to fetch arguments by name or by index, and to enumerate the arguments.

Some of the most useful methods on Script.Args allow you to ask for the value of a named argument, and specify a default value to return if the argument doesn't exist. This form is used in many of the example scripts. Examine the script MakeMarkers.cs for an example of how to query for arguments within a script.


You can create menu items on the Script Menu that include arguments by using Windows shortcuts (.lnk files) in the Script Menu folder.

Also you can pass arguments to the Script Editor's script by typing them into the edit box at the top of the Script Editor window within Sound Forge. The syntax there is the same as on a command line, except that the ? is not necessary.

tj




Message last edited on11/18/2006 4:04:51 PM by_TJ.
Subject:RE: External soundforge parameters
Reply by: timaddy
Date:11/22/2006 9:03:22 AM

Thanks for the info. Tested and works.

Tim

Subject:RE: External soundforge parameters
Reply by: timaddy
Date:11/22/2006 9:04:15 AM

Is there anyway of changing the temporary files directory via a parameter?

Best Regards

Tim

Subject:RE: External soundforge parameters
Reply by: _TJ
Date:11/27/2006 12:44:51 PM

Sorry, no. -tj

Subject:RE: External soundforge parameters
Reply by: epsobolik
Date:6/20/2007 10:25:40 AM

Cool. Is it possible to run a batch converter with a command line parameter? I have to process the audio on a bunch of .avi's and then convert the .avi's to .wmv's. If I could do the whole thing with a VBS script it would be great. Hmmm, maybe I could do the whole thing in a SF script...

Subject:RE: External soundforge parameters
Reply by: _TJ
Date:6/20/2007 10:56:57 AM

You can start the batch converter from a command line, but that would just bring up the user interface, there isn't any way to tell it to start running the batch job from the command line, and there isn't any way to tell it what files to process from the command line.

However, the batch converter engine is script-accessible. So you could write a script that loads a batch job, chooses a bunch of files, then passes those into the batch engine to run.

Essintially, you can replace the user interface part of the Batch Converter with a script.

See the script samples CreateBatchJob.cs, or BatchRenderSubfoldersc.cs for examples of how to invoke the batch engine.

The basic code to use the Batch Engine from script looks like this


using SoundForge.BatchConverter;

....

FileRegionCollection files = new FileRegionCollection();

// insert your own code to add files to the collection here.

BatchJob bj = new BatchJob();

// insert your own code to add tasks to the batch job here,

// create an initialize an instance of the batch engine.
Engine engine = new Engine();
engine.StatusEvent += new Engine.StatusEventHandler(job_StatusEvent);
engine.TotalEvent += new Engine.TotalEventHandler(job_TotalEvent);
engine.ProgressEvent += new Engine.ProgressEventHandler(job_ProgressEvent);

SfStatus ret = SfStatus.Success;
try
{
engine.Cancel = false;
ret = engine.Run(bj, files); // run the batch.
}
catch (Exception e)
{
DPF(e.ToString());
ret = SfStatus.Fail;
}
finally
{
engine.Clear();
app.SetStatusField(0, ret.ToString());
}




Subject:RE: External soundforge parameters
Reply by: epsobolik
Date:6/21/2007 5:50:09 AM

Thanks. I had found that sample and did exactly as you suggested. Works great. I also have to convert the .avi's to .wmv's with MS Media Encoder. So, I added calls to a batch file that calls cscript... I have to prepare a couple of hundred little 1-minute .avi's for a help system. So this is going to be REALLY useful!

Go Back