A little scripting help

Musician wrote on 3/20/2008, 9:27 PM
Guys, I apologize upfront. I am new to scripting but working hard at learning it quickly. I am having trouble wrapping my head around the Vegas API documentation, so I came up with a little script that I think if someone could help me with, that I would be able to put all of the rest of the pieces together myself. Could someone please write a small C# script that would accomplish the following:

Take an image file from c:/Bill/Image_1001.jpg and place it on Track 3 at timecode 0:0:10.00 and make it last for 10 seconds.

Any help with this would be appreciated. I think the syntax for this exercise would help me to understand timecode manipulation, file access, TrackEvents, and many other things.

Comments

jetdv wrote on 3/20/2008, 9:45 PM
Here's one way:

Track myTrack = myVegas.Project.Tracks[2];
Media media = new Media("c:\\Bill\\Image_1001.jpg");
MediaStream stream = media.Streams[0] as MediaStream;
VideoEvent newEvent = new VideoEvent(new Timecode("00:00:10:00"), new Timecode("00:00:10:00"));
myTrack.Events.Add(newEvent);
Take take = new Take(stream);
newEvent.Takes.Add(take);
Musician wrote on 3/20/2008, 10:21 PM
Ed, you are a life saver. I had everything figured out but the takes. I had my track selected, my new event declared and created, but it was coming up on the timeline as an empty video event, and I couldn't figure out how to associate a file with that event - Takes. Thank you. You are one of the greatest resources on these forumns and we appreciate all that you do to contribute. Thanks.