6 posts
  • Has been part of the Envato Community for over 3 years
sososm says

Hey everyone,

there is a little problem I have, since i’m using Sound Forge 10, I started to use the included scripts. Now this is what I want, a script that renders the opened file to a specified folder but with a new name which is taken from a .xml file on the same location as the .wav file already open. I’m opening a .wav file from a web link on my home network ex:

//192.168.1.1/audiofiles/20100203/20100203144516.wav, name which is the date and time of the file, and I want to save the file to my d:\ partition with the name from that xml file //192.168.1.1/audiofiles/20100203/20100203144516.xml so rendered filename should look like this:

2010-02-03_14.45.16 .wav

If there is anybody who can help me to achieve this I’ll really apreciate it. Thanx in advance..

I’ve already personalized the script for saving and closing the file without asking. Here is the script I have so far:

using System; using System.IO; using System.Windows.Forms; using SoundForge;

public class EntryPoint { public string Begin(IScriptableApp app) { // find the renderer

ISfRenderer rend = null;
if (fmt[0].StartsWith("."))
    rend = app.FindRenderer(null, fmt[0]);
else
    rend = app.FindRenderer(fmt[0], null);
if (null == rend)
{
   DPF("renderer for type {0} not found - skipping to next", fmt[0]);
   continue;
}
// determine if the preset is a string or an integer
//
object vPreset = fmt[1];
string szName = String.Format("{0}", szBase, fmt[1], rend.Extension);
DPF("rendering {0}", szName);
string szFilename = Path.Combine(szDir, szName);
DPF(" ~ {0}", szFilename);
DPF(rend.Guid + " " + vPreset + " '" + szDir + "'");
// now, render the file
//
file.RenderAs(szFilename, rend.Guid, vPreset, null, RenderOptions.RenderOnly);
SfStatus result = file.WaitForDoneOrCancel();
if (result != SfStatus.Success)
   continue;

file.Close(CloseOptions.DiscardChanges);

} // foreach
return null;

}

public void FromSoundForge(IScriptableApp app) { ForgeApp = app; //execution begins here app.SetStatusText(String.Format(“Script ‘{0}’ is running.”, Script.Name)); string msg = Begin(app); app.SetStatusText(msg != null ? msg : String.Format(“Script ‘{0}’ is done.”, Script.Name)); } public static IScriptableApp ForgeApp = null; public static void DPF { ForgeApp.OutputText(sz); } public static void DPF { ForgeApp.OutputText(String.Format(fmt,o)); } public static void DPF { ForgeApp.OutputText(String.Format(fmt,o,o2)); } public static void DPF { ForgeApp.OutputText(String.Format(fmt,o,o2,o3)); } public static string GETARG { string val = Script.Args.ValueOf(k); if (val null || val.Length 0) val = d; return val; } public static int GETARG { string s = Script.Args.ValueOf(k); if (s null || s.Length 0) return d; else return Script.Args.AsInt(k); } public static bool GETARG { string s = Script.Args.ValueOf(k); if (s null || s.Length 0) return d; else return Script.Args.AsBool(k); } } //EntryPoint
6 posts
  • Has been part of the Envato Community for over 3 years
sososm says

Sorry the last line was not formatted correctly, here is

//192.168.1.1/audiofiles/20100203/20100203144516.wav, name which is the date and time of the file, and I want to save the file to my d:\ partition with the name from that xml file //192.168.1.1/audiofiles/20100203/20100203144516.xml so rendered filename should look like this: “ 2010-02-03_14.45.16 .wav”

6 posts
  • Has been part of the Envato Community for over 3 years
sososm says

http://image.bayimg.com/dadkjaadk.jpg

this is what I want finally.

by
by
by
by
by
by