Community Forums Archive

Go Back

Subject:SF8 scripts in SF9?
Posted by: ghova
Date:4/27/2007 11:31:31 AM

Will scripts developed for SF8 work in SF9?

Glancing at the CHM, it looks very similar... right down to saying "Sound Forge 8.0" instead of "Sound Forge 9.0" in the opening paragraph. :)

Subject:RE: SF8 scripts in SF9?
Reply by: _TJ
Date:4/28/2007 1:59:29 PM

Scripts written for 8 should work fine in 9.

There were a few additions to the ISfFileHost and IScriptableApp interfaces, so scripts pre-compiled into .DLL files will have to be re-built.

If you come across a script written for 8 that doesn't work in 9, please let us know. It's likely to be unintentional.

tj





Subject:RE: SF8 scripts in SF9?
Reply by: garrigus
Date:7/7/2007 4:02:33 PM

Hi TJ,

Here's a script that works in SF8 but doesn't in SF9. What happens is the script runs fine and it does the Resample, but it doesn't run the effect. It simply does the Resample and that's it.

Can you tell me what might be wrong?

Thanks,
Scott


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

public class EntryPoint {

public void Begin(IScriptableApp app) {


Do("Process.Resample", false); // true to use last settings
SfAudioSelection asel = app.ActiveWindow.EditRegion;
app.CurrentFile.DoEffect("Perfect Space", 0, asel, EffectOptions.DialogFirst);


}

public static void Do(string cmd) { ForgeApp.DoMenuAndWait(cmd,false); }
public static void Do(string cmd, bool fUseLastPreset) { ForgeApp.DoMenuAndWait(cmd,fUseLastPreset); }

public void FromSoundForge(IScriptableApp app) {
ForgeApp = app; //execution begins here
app.SetStatusText(String.Format("Script '{0}' is running.", Script.Name));
Begin(app);
app.SetStatusText(String.Format("Script '{0}' is done.", Script.Name));
}
public static IScriptableApp ForgeApp = null;
} //EntryPoint

Subject:RE: SF8 scripts in SF9?
Reply by: ForumAdmin
Date:7/9/2007 7:48:33 AM

Assuming "Perfect Space" is a third-party VST, you need to make sure you've configured Sound Forge 9.0 prefs to be able to find and use it first (Options->Preferences->VST Effects).

Does this effect work properly when you just try to use it directly?

J.

Subject:RE: SF8 scripts in SF9?
Reply by: garrigus
Date:7/9/2007 11:19:42 AM

Hi J.

Perfect Space was just an example. The script won't launch any effect entered in the string. I know it's finding the effect because if I put something in there that's not recognizable, then SF will pop up with an item not found error. So for some reason it's just not launching the effect.

Thanks,
Scott

Subject:RE: SF8 scripts in SF9?
Reply by: ForumAdmin
Date:7/12/2007 3:46:14 PM

The DoMenu call was returning immediately from the semi-modeless resample dialog and falling through to the DoEffect call. It should pop an exception indicating a user cancel, so I'm not sure why you aren't seeing that, but then it must fall out the end of the script. When you OK the resample, that works, but the script has already exited.

This will be fixed up in the next update. For this version, we'll be enforcing modal dialogs from DoMenu (we already do so for DoEffect).

Thanks,
J.

Message last edited on7/12/2007 3:46:32 PM byForumAdmin.
Subject:RE: SF8 scripts in SF9?
Reply by: garrigus
Date:7/12/2007 5:33:37 PM

Hi J,

Okay, cool... so in the meantime, is there any way to make this work in SF9? Even if the script needs to be totally rewritten?

Thanks,
Scott

Message last edited on7/12/2007 5:34:27 PM bygarrigus.
Subject:RE: SF8 scripts in SF9?
Reply by: ForumAdmin
Date:7/13/2007 7:33:33 AM

Use DoEffect instead of DoMenu.

Subject:RE: SF8 scripts in SF9?
Reply by: garrigus
Date:7/13/2007 1:20:46 PM

Whoops! Yeah, I should have picked that up from your last reply. :-)

That did the trick...

Thanks!
Scott

Subject:RE: SF8 scripts in SF9?
Reply by: ghova
Date:9/17/2007 7:52:29 AM

One other note pertaining to this topic... Compilation of VBScripts is a little more rigorous in SF9, and all functions must return a value. Functions in the VBScript template in SF8 did not return a value.

This means that all VBScript scripts written in SF8 will have to be tweaked in order to compile in SF9.

I haven't tried it with my C# scripts yet, though.

Go Back