Community Forums Archive

Go Back

Subject:Help with "Modify Summary Info" script
Posted by: Vocalpoint
Date:3/17/2005 11:23:35 AM

All,

Just working my way thru the new features of SF8 and the scripting module looks very cool. The one script that really interests me is the Modify Summary Infomation script. This one writes custom metadata info (Properties->Summary->Extended) into each open file - perfect for batch processing etc etc.

My use of Forge is in the radio voiceover area and being able to run this script against all open files allows me to populate each file with my company info, creation date etc etc. That metadata then appears nicely in converted files (like MP3) for shipment to my clients.

The one most important field that I need help with is the Title field. If this field is left blank, subsquent batch processing (like to MP3) results in a file title that is blank or truncated by some weird process. What I want to do is transfer (via code) the actual filename that each open file is saved as into this Title field.

The problem with the Modify Summary script is that the struct "sumy" is prepopulated with static values. As a result those value get written to every file the same way....I need to be able to write the Title field dynamically using the filename of the open file being processed - something like:

sumy.Title = App.ActiveFile.Filename

Of course - I am just blueskying here since I have no idea how to call/reference the active file name (new at this kind of scripting).

Any help would be totally appreciated!

Cheers,

VP


Subject:RE: Help with "Modify Summary Info" script
Reply by: jetdv
Date:3/17/2005 12:27:00 PM

What about:

file.Window.Title

Subject:RE: Help with "Modify Summary Info" script
Reply by: knowbody
Date:3/17/2005 11:29:12 PM

I'm very interested in finding an answer for this. I tried:

sumy.Title = "App.ActiveFile.Filename";
sumy.Title = "file.Window.Title";
sumy.Title = App.ActiveFile.Filename;
sumy.Title = file.Window.Title;

The first two copied the text exactly (ie the actual file name was ignored), the second two gave error messages. I know very little about scripting. Does anyone have any other ideas?

Thanks,

Chris (Hunt)

Subject:RE: Help with "Modify Summary Info" script
Reply by: jetdv
Date:3/18/2005 6:37:51 AM

You definitely want WITHOUT the quotes.

file.Filename should return the name of the file. However, file.Window.Title should be valid and not give an error.

I tried both:

sumy.Title = file.Filename;
sumy.Title = file.Window.Title;

both worked fine but you probably want to use file.Window.Title as the other includes the full path.

Subject:RE: Help with "Modify Summary Info" script
Reply by: Vocalpoint
Date:3/18/2005 8:16:35 AM

Jet,

I get the following error when changing:

sumy.Title = "Title"; to
sumy.Title = file.Filename;

Compiler error 0x80004005 on Line 20,24 : The type or namespace name 'file' could not be found (are you missing a using directive or an assembly reference?)

Obviously - I think I need to make this call farther down in the script - Not like this:

SfSummaryInfo sumy = new SfSummaryInfo();

//start MODIFY HERE -----------------------------------
//- Type your own information in the area below.
//- Be careful to keep your own information within the quotes
//- If you do NOT information updated, comment it out in this script, using two forward slashes (//)

sumy.Title = file.Filename;
sumy.Subject = "Voiceover 2005";
sumy.Copyright = "Copyright " + ((char)169).ToString() + " 2005.";
sumy.Comments = "www.vocalpoint.ca";
sumy.CreationDate = "2005";
sumy.Genre = "Speech";
sumy.Album = "Vocalpoint Studios";
sumy.Artist = "Bruce McDonald";
sumy.WebPage = "www.vocalpoint.ca";
sumy.Location = "Calgary, AB";


But where?

Cheers!

VP

Subject:RE: Help with "Modify Summary Info" script
Reply by: jetdv
Date:3/18/2005 9:57:11 AM

Ok, I was looking at an OLD version of that script. Look for this section:


foreach (ISfFileHost file in app.Files)
{
if (fClearExisting)
file.Summary = sumy;
else
ApplySummaryInfo(file, sumy);
}


and change it to this:


foreach (ISfFileHost file in app.Files)
{
sumy.Title = file.Filename;
if (fClearExisting)
file.Summary = sumy;
else
ApplySummaryInfo(file, sumy);
}

Subject:RE: Help with "Modify Summary Info" script
Reply by: Vocalpoint
Date:3/18/2005 10:53:36 AM

Jet,

That worked - BUT - in the Title field - SF puts the filename alright - with the entire pathname attached. In my case - I tested on a bunch o files from a location seven folders deep....which makes this fairly useless.

Now I gues I have to find a way to trim all the path info off and just retain the actual filename.

Man - what a chore. Wavelab just lets me save my file and then batch it out and it always uses the filename(with no long ass path data attached) for the Title field...all by default with no scripting or nothing....sigh....

VP

Subject:RE: Help with "Modify Summary Info" script
Reply by: jetdv
Date:3/18/2005 11:11:32 AM

That's why I said in the previous post you would probably want to use:

file.Window.Title;


instead. That will give you the filename WITHOUT the path.

Message last edited on3/18/2005 11:12:39 AM byjetdv.
Subject:RE: Help with "Modify Summary Info" script
Reply by: Vocalpoint
Date:3/18/2005 11:37:50 AM

Jet,

That worked. But this mod also adds the file extension - for example - if I batch convert a file called TestSong.wav to an MP3....the Title portion of the metadata gets "TestSong.wav"

In Winamp or Media Player - this of course appears as the title of the track when in fact I just want it to be "TestSong". I guess FileName is not what I want after all.

Thanks again...I am now off to learn how to read before I type :)

VP

Message last edited on3/18/2005 11:45:37 AM byVocalpoint.
Subject:RE: Help with "Modify Summary Info" script
Reply by: jetdv
Date:3/18/2005 12:04:28 PM

Ok. Try this:

sumy.Title = Path.GetFileNameWithoutExtension(file.Filename);

Subject:RE: Help with "Modify Summary Info" script
Reply by: Vocalpoint
Date:3/18/2005 12:57:58 PM

Jet,

Got it! Thanks a ton.

Have a great weekend!

VP

Subject:RE: Help with "Modify Summary Info" script
Reply by: jetdv
Date:3/18/2005 1:03:09 PM

Glad we could finally get it all worked out!

Subject:RE: Help with "Modify Summary Info" script
Reply by: knowbody
Date:3/18/2005 2:48:04 PM

Thanks for working on this, Jet. I still can't get it to work.

In the Start Modify Section I have:
sumy.Title = "Title";

Lower down I changed the section you mentioned as follows:

else
{
foreach (ISfFileHost file in app.Files)
{
sumy.Title = Path.GetFileNameWithoutExtension(file.Filename);
if (fClearExisting)
file.Summary = sumy;
else
ApplySummaryInfo(file, sumy);
}
}

When I run the script I just get Title as the tiltle. If I don't have the quotes in the Modify Section then I get an error message. What am I doing wrong?

Thanks,

Chris (Hunt)

Subject:RE: Help with "Modify Summary Info" script
Reply by: jetdv
Date:3/18/2005 6:34:30 PM

Are you choosing the option to change ALL files? To modify the selected file version requires modifying a different location in the script. If you are selecting to only modify a single file, look for:


if (app.CurrentFile != null)
{
if (fClearExisting)
app.CurrentFile.Summary = sumy;
else
ApplySummaryInfo(app.CurrentFile, sumy);
}


and change it to:


if (app.CurrentFile != null)
{
sumy.Title = Path.GetFileNameWithoutExtension(app.CurrentFile.Filename);
if (fClearExisting)
app.CurrentFile.Summary = sumy;
else
ApplySummaryInfo(app.CurrentFile, sumy);
}

Subject:RE: Help with "Modify Summary Info" script
Reply by: knowbody
Date:3/18/2005 10:14:26 PM

That's it! You hit it exactly right - I was only trying to change one file. I edited the script as you described and it works fine now. Many thanks.

Chris (Hunt)

Go Back