Script to grab IN and OUT timecode

pctechtv wrote on 8/19/2014, 12:00 PM
Hi, I need to create a script that grabs the IN and OUT time code of a work area. I said let me check here to see if one already exists. The reason I want to do this is because I need to use the same positions of Vegas’ Closed Captioning (which is not working currently - http://www.sonycreativesoftware.com/forums/ShowMessage.asp?ForumID=4&MessageID=901064) in another application for DVD authoring. The other application being Encore DVD. I want to be able to export the IN and OUT, other than that I would just find that useful anyway for various things I do with video. If anybody knows anything or has suggestions to a way or why this may not be the best way to get my list please let me know.

Comments

jetdv wrote on 8/19/2014, 12:44 PM
/**
* This script will show the various selection starts and lengths.
*
* Written By: Edward Troxel
* Modified: 07-18-2007
**/

using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Reflection;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;

public void FromVegas(Vegas vegas)
{
myVegas = vegas;

string myMessage = "";

myMessage += "Cursor = " + myVegas.Cursor + "\n";

myMessage += "TransportCursor = " + myVegas.Transport.CursorPosition + "\n";

myMessage += "SelectionStart = " + myVegas.SelectionStart + "\n";

myMessage += "SelectionLength = " + myVegas.SelectionLength + "\n";

myMessage += "TransportSelectionStart = " + myVegas.Transport.SelectionStart + "\n";

myMessage += "TransportSelectionLength = " + myVegas.Transport.SelectionLength + "\n";

myMessage += "TransportLoopRegionStart = " + myVegas.Transport.LoopRegionStart + "\n";

myMessage += "TransportLoopRegionLength = " + myVegas.Transport.LoopRegionLength + "\n";

MessageBox.Show(myMessage);

}



}
pctechtv wrote on 8/19/2014, 1:10 PM
Thanks so much, this is very helpful!
pctechtv wrote on 8/19/2014, 1:49 PM
Thanks for all the help. I seem to get these errors when using in Vegas Pro 13.
See pic here:
http://pctechtv.com/ExSupport/Sony/Vegas/13.0Build373/IOScript/ScripErrors.png

I cleared some by using import lines eg.
var noTime = new Timecode();
import System.Text;
import System.Drawing;
... etc.
using the strict typing cleared some errors, but my specific knowledge of this type of scripting is not that vast yet. I love this because I know from here I will start utilizing this great tool to create interesting scripts.You and this community have helped me learn. I love it!


Warper wrote on 8/20/2014, 3:25 AM
Looks like you saved script into javascript file, but it's written in c#.
Delete old script , save text to GrabIO.cs file and try it.
pctechtv wrote on 8/20/2014, 7:53 AM
That is very helpful also! Tell me can the code or Vegas scripting make the message copy to the Windows Clip board? I guess it would have to do Edit command and Copy? Is that possible in Vegas. If you or anybody know that is what I really want to accomplish. Thanks
Warper wrote on 8/20/2014, 8:55 AM
I've never tried to work with clipboard in Vegas, to be honest.
IT should be possible, though.
Please try this recipe, it might work for Vegas scripts written in C#:
http://stackoverflow.com/questions/3546016/how-to-copy-data-to-clipboard-in-c-sharp
pctechtv wrote on 8/20/2014, 11:40 AM
Works like a CHARM! Thank you Warper, jetdv and this great community; not for only helping me solve this, but for getting me started on my way to do useful things with Vegas Scripting!!! I am so excited; YES! I hope all can benefit from this post. Thanks!