Event Info

pctechtv wrote on 8/25/2014, 9:48 AM
Could some one show examples of grabbing Event (Vegas Event) info? For example like Event length. I guess there would have to be some property/attribute that determines Event selected state or not. I am thinking that there may be more to it to grab; for example the selected Event or Events. Maybe a loop has to check each and return a list of selected Events. Any help examples or ideas are very welcome. Thanks

Comments

Gary James wrote on 8/25/2014, 10:41 AM
Can you be specific and describe what you want to accomplish? Examples are useful if they apply to your needs..
pctechtv wrote on 8/25/2014, 12:39 PM
I want to select and event and then send info to a message box like:
how long it is?
where it live on the timeline?
Thanks
Gary James wrote on 8/25/2014, 2:03 PM
Are you saying that you want to Manually select an Event, or Programmatically select an Event and then display Start Time and Length?

if you want to manually select a Track and then select an Event, this will show your Event info in a Messagebox. Just save this with a .CS file extension.


using System;
using System.Text;
using System.Collections;
using System.Windows.Forms;
using System.Collections.Generic;

using Sony.Vegas;

// API exposed for Sony Vegas to call into
public class EntryPoint
{
// API function called by Sony Vegas when script is Run
public void FromVegas ( Vegas vegas )
{
foreach ( Track track in vegas.Project.Tracks )
{
if ( track.Selected )
{
foreach ( TrackEvent te in track.Events )
{
if ( te.Selected )
{
MessageBox.Show ( "Event " + te.Index.ToString () + " in Track " + track.Index.ToString () + " Starts at " + te.Start.ToPositionString () + " with a Length of " + te.Length.ToPositionString () );
return;
}
}
}
}
}
}
pctechtv wrote on 8/25/2014, 2:57 PM
Wow thanks so much! Extremely helpful to start understanding. All examples and ideas welcome. This will help me build. I don't know all the differences between Manually or Programmatically but the example you provide has got me started. I am pretty sure I mean Manually because I would have clicked on it first. Thanks!