-
How to generate text in scripting?
Posted by Austin Brock on October 2, 2013 at 4:43 pmI have this example code to “insert text media” using scripting…
PlugInNode generator = app.Generators.GetChildByName("Sony Text");
media = new Media(generator, "Footy Scores");
stream = media.Streams[0];
newEvent = new VideoEvent(evnt.Start, evLen);
titleTrack.Events.Add(newEvent);
take = new Take(stream);
newEvent.Takes.Add(take);… but the code implies I have to use presets to determine what is written, and that I don’t have any control over it otherwise.
Is this true, or is there another way?
Austin Brock replied 10 years, 9 months ago 2 Members · 6 Replies -
6 Replies
-
Edward Troxel
October 2, 2013 at 6:28 pm -
Austin Brock
October 2, 2013 at 6:28 pmCould you possibly give some examples of the OpenFX plugins, please?
-
Edward Troxel
October 3, 2013 at 5:27 pm -
Austin Brock
October 3, 2013 at 5:31 pmMy request was for example code for using “Sony Titles & Text” and customizing the text used.
-
Edward Troxel
October 8, 2013 at 8:26 pm -
Austin Brock
December 31, 2013 at 10:15 pmIf anyone wonders how I did this eventually, I made the format of the text I required in Sony Vegas, and then wrote C# to recreate the file I was using, like a temp.xml, and just overwrote it before using.
Then I insert that media, and viola, it displays the correct text.
// List of White Scorers
generatorb = app.Generators.GetChildByName("Sony Titles & Text");
CreateWhiteList(WhiteScoreString);
mediad = new Media(generatorb, "EndScoresWhite");streamd = mediad.Streams[0];
newEventd = new VideoEvent(endDisplay, endDisplayFor);
app.Project.Tracks[2].Events.Add(newEventd);
taked = new Take(streamd);
newEventd.Takes.Add(taked);public int CreateWhiteList(string str)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "OFX Presetscom.sonycreativesoftware_titlesandtextGenerator" + "endscoreswhite.xml";if (File.Exists(path))
File.Delete(path);using (StreamWriter sw = File.AppendText(path))
{
sw.WriteLine("<?xml version="1.0" encoding="UTF-8"?>");
sw.WriteLine("");
sw.WriteLine("com.sonycreativesoftware:titlesandtext");
sw.WriteLine("1 0");
sw.WriteLine(" {rtf1ansiansicpg1252deff0{fonttbl{f0fnilfcharset0 Interstate;}}");
sw.WriteLine("viewkind4uc1pardlang1033bf0fs13 " + str);
sw.WriteLine("}");
sw.WriteLine("");
sw.WriteLine("");
sw.WriteLine("0.952941 0.952941 0.952941 1.000000");
sw.WriteLine(" _None");
sw.WriteLine("");
sw.WriteLine("1.000000");
sw.WriteLine("0.533000 0.220000");
sw.WriteLine("0");
sw.WriteLine("0.000000 0.000000 0.000000 0.000000");
sw.WriteLine("0.000000");
sw.WriteLine("1.000000");
sw.WriteLine("7.500000");
sw.WriteLine("0.000000 0.000000 0.000000 1.000000");
sw.WriteLine("false");
sw.WriteLine("0.000000 0.000000 0.000000 1.000000");
sw.WriteLine("0.200000");
sw.WriteLine("0.200000");
sw.WriteLine("0.400000");
sw.WriteLine("");
}
return 1;
}
Reply to this Discussion! Login or Sign Up