Subject:Converting to VS2003...
Posted by: D-Slam
Date:2/1/2006 2:39:46 PM
Hi TJ - I'd gotten quite far on the scripts authoring in the script editor. I finally received a copy of VS2003, and having trouble wrapping my mind around how to convert my scripts into VS C# format. It appears that there are a few different components needed, and what used to exist 'inline' in now broken out into a couple of places within VS. Any chance you could start a tutorial thread on porting? Or perhaps comment one of your vanilla all purpose scripts with what should go where? thanks Message last edited on2/1/2006 2:42:48 PM byD-Slam. |
Subject:RE: Converting to VS2003...
Reply by: _TJ
Date:2/1/2006 8:53:42 PM
There is no 'porting'. You can use VS2003 to write scripts (in a way). But Sound Forge still has to be the host for execution. The syntax of your script is exactly the same, the only difference is whether you compile & run in Sound Forge. or compile in VS2003 and run in Sound Forge. Your scripts have to be DLL's rather than Applications, and you still have to run them from within Sound Forge. Just compile your dll assembly in VS2003, copy it into Sound Forge's Script Menu folder, and it will show up as a item in the Script Menu. Or "open" the dll in the Script Editor, and run it from there. (Naturally, you can't edit a dll in the Script Editor, but it lets you open them so that you can pass arguments and use the 'run' button). I'll see if I can't find some instructions on using VS2003 to create 'precompiled scripts', which is what we call it when you do your development outside of the Script Editor rather than inside it. I thought there were some already posted in the forums or SDK. but I can't look right now, and if there aren't any instructions. I'll write something up. There are some very cool features of VS2003 that will make you a lot more productive. Enjoy. |
Subject:RE: Converting to VS2003...
Reply by: D-Slam
Date:2/3/2006 12:36:23 PM
So I'm having a really hard time with debugging. For some reason, the dll I'm compiling isn't halting on breakpoints in VS. I'm in debug mode, I've set the project's debug properties to program and all the other things I can think of...like references to Forge80.script etc I'm not able to compile while SoundForge is open, I have to quit each time. I guess it's not releasing something. Any ideas? |
Subject:RE: Converting to VS2003...
Reply by: D-Slam
Date:2/3/2006 1:04:08 PM
It turns out VS2003 can get confused when linking to debigging info. Setting "generate debug info" in project properties to true fixed the problem. |
Subject:RE: Converting to VS2003...
Reply by: _TJ
Date:2/4/2006 12:04:01 PM
I'm not able to compile while SoundForge is open, I have to quit each time. I guess it's not releasing something. More like not releasing anything. The startup time cost for .NET is several seconds, but once it's started, the time between when you hit the Run Script button and when it runs is much less than a second. Set up your .NET solution to start Sound Forge whenever you debug or run your project. What I usually do is from a command prompt type: devenv.exe \path-to-sound-Forge\Forge80.exe This will have DevStudio create a 'debug' solution for Sound Forge. Then ADD your .NET project to this solution, and set the Debug type to "managed only". then whenever you choose Start from the Debug menu, it will compile your solution, then start up Sound Forge. You can even pass Sound Forge a command line argument telling it to run your script as it starts up. the syntax is Forge80.exe /Script:"path-to-your-script.dll?arg1=val1&arg2=val2" the ? separates your script filename from arguments. The syntax is just like a URL except you don't have to escape spaces. Arguments can be queried from the script by referencing the Script.Args collection. This gives you a way to put multiple scripts in a single dll. To give you an idea of what's possible. here's the entry point of a multi-function pre-comiled script that I wrote for my own use. /// <summary> /// Summary description for EntryPoint. /// </summary> public class EntryPoint { public string GetArg(string key, string def) { string val = Script.Args.ValueOf(key); if (null != val) return val; return def; } public bool GetArg(string key, bool def) { if (Script.Args.Exists(key)) return Script.Args.AsBool(key); return def; } public void FromSoundForge(SoundForge.IScriptableApp app) { string job = GetArg("job","RipTracks").ToLower(); app.SetStatusText(String.Format("Script {0} {1} is running.", Script.Name, job)); string szRootPath = GetArg("dir", @"E:\Media\Rip"); switch (job) { default: case "riptracks": { TjRip rip = new TjRip(app); rip.RipTracksToFiles(aszRend, szRootPath); } break; case "ripwholecd": { TjRip rip = new TjRip(app); if (rip.Configure()) rip.RipWholeCD(); } break; } app.SetStatusText(String.Format("Script {0}{1} is done.", Script.Name, job)); } } |