Community Forums Archive

Go Back

Subject:Feature Request: Supressing modal dialogs
Posted by: ghova
Date:7/19/2005 2:35:48 PM

Hi there...

As I mentioned in an earlier thread, I'm using Sound Forge 8 in our new batch automation system.

.NET scripting has been absolutely amazing in all facets except for one: modal dialogs. There are instances where Sound Forge insists on bringing up a modal dialog, even when the issue that brought up the modal dialog is handled in a try... catch handler.

Of course, the problem with a modal dialog is that the script halts and will not resume until the dialog is cleared. This is a disaster in an automated batch environment because no one is around to hit the OK button! This is a shame, as everything else about .NET scripting lends itself wonderfully to an automated batch environment.

The two times I've seen modal dialogs stop a script so far have been...

1) When Sound Forge is attempting to open a corrupt file.

2) When Sound Forge opens a file with bad markers.

There are some workarounds I can do for this (have the parent program that's feeding Sound Forge restart it if it's inactive for a set period of time, try to find a shareware program that automatically dismisses certain dialog boxes), but they're all fiddly, time-consuming, and their extra complexity increases the likelihood of something going wrong.

For me, the most elegant solution to this problem would be to have some sort of switch I could code in that would supress all modal dialogs as long as my script handles the error. This way, the problem is logged and dealt with, but the script keeps going.

I'll post this in Sony's suggestion forum, but I just wanted to remind everyone that this is the one issue that keeps a good product from being a great product.

Thanks again for your time!

~Gil

Subject:RE: Feature Request: Supressing modal dialogs
Reply by: ghova
Date:7/21/2005 3:51:24 PM

If anyone else is having the same problem I have (modal dialogs stopping automated scripts), then check out Buzof. It's a program that automatically dismisses any dialog box you specify.

I put the demo version on several of our batch computers, and they've knocked out about twelve modal dialogs between all of them. That's twelve times today we would have wondered why the files are taking so long, and had to manually clear the box so the script could continue.

Next week, we'll probably plop down some money to buy a bunch of licenses. This will hold us until Sony patches the scripting to supress modal dialogs (I hope - if not, we have to spend extra money on each encoding computer we buy. Not cool).

~Gil

Subject:RE: Feature Request: Supressing modal dialogs
Reply by: _TJ
Date:8/4/2005 12:24:51 AM

The Sound Forge 8.0b update is now available for download
http://www.sonymediasoftware.com/download/step2.asp?DID=593

It has a new script method that enables the suppression of error message
boxes.

Now, once you suppress them, you must check for and clear any error state
before you re-enable them, or any stored but unreported error will pop up and
get reported by Sound Forge at the next command.

The basic mechanism is this


// before you begin operations for which you want to suppress error boxes.
Script.Forge.ErrorMode = SoundForge.ForgeErrorMode.SuppressErrorBoxes;

try
{
// do stuff that could report an error.
}
catch (Exception ex)
{
string strReport = ex.Message;

COMException ecom = ex as COMException;
if (null != ecom)
{
// get a string for the error code
string strError = Script.Forge.GetErrorCodeString(ecom.ErrorCode);
// get (and clear) the Sound Forge error state.
strReport = Script.Forge.GetErrorReport(ecom.ErrorCode, true);
}

// log the error
DPF("error: {0}", strReport);
}

// put the error mode state back to normal.
Script.Forge.ErrorMode = SoundForge.ForgeErrorMode.Normal;



tj




Message last edited on8/4/2005 12:38:36 AM by_TJ.
Subject:RE: Feature Request: Supressing modal dialogs
Reply by: ghova
Date:8/5/2005 1:11:22 PM

Great stuff. Thanks! I'm pretty deep into the development cycle right now, but I'll get this in for version 2.

I'm looking forward to trying it out!

Subject:RE: Feature Request: Supressing modal dialogs
Reply by: ghova
Date:8/23/2005 11:45:13 AM

Fantastic! It works exactly the way it's supposed to. Our batch system can now run hands-free.

Thanks to everyone at Sony, especially SonyTJ, for their time!

~Gil

Go Back