www.jetdv.com Forum Index Edward Troxel
Vegas Scripting and Newsletters
Home of Excalibur and Montage Magic
 
 FAQ   Search   Memberlist   Usergroups   Register   Profile 
 Log in to check your private messagesLog in to check your private messages   Log inLog in 

Media Bin baby steps

 
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Scripting FAQ
View previous topic :: View next topic  
Author Message
saxman



Joined: 27 Jan 2008
Posts: 2

PostPosted: Wed Mar 19, 2008 7:50 am    Post subject: Media Bin baby steps Reply with quote

Hi Edward and crew. I am new to this forumn and new to scripting as well. I studied Fortran in college which is of little help now, but I have been reading two C# books and think that I know enough to start causing trouble. My first attempt at a basic script failed and I was hoping that someone might be able to explain my mistake. This script had the very easy task of just adding a new media bin, but it crashed and I don't understand why. Any help would be greatly appreciated.

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Sony.Vegas;

namespace General_Script
{
public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
string bin1 = "Bill";
MediaBin billBin = new MediaBin(bin1);
Vegas.Project.MediaPool.RootMediaBin.Add(billBin);

}
}
}
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Wed Mar 19, 2008 3:01 pm    Post subject: Reply with quote

On this line:

Vegas.Project.MediaPool.RootMediaBin.Add(billBin);

The "V" in Vegas should be lower-case:

vegas.Project.MediaPool.RootMediaBin.Add(billBin);



In this line:
public void FromVegas(Vegas vegas)

"vegas" is the variable name, "Vegas" is the variable type.

I usually do something like:

public class EntryPoint
{
Vegas myVegas = null;
public void FromVegas(Vegas vegas)
{
myVegas = vegas;

and then use "myVegas" as the variable name from that point forward.
Back to top
View user's profile Send private message Send e-mail
saxman



Joined: 27 Jan 2008
Posts: 2

PostPosted: Thu Mar 20, 2008 8:40 pm    Post subject: Reply with quote

Thanks Edward. I understand the math and logic that I need to do my particular script, but I am really struggling with the syntax,especially in the Vegas API. For instance, in the script above and looking at the Vegas API, under MediaPool Class there is a property RootMediaBin which I used. Also under MediaPool Class, there is a method called Add that says that is not supported, but it worked in my script. So is the Add method that I used the one that is not supported under MediaPool, or does it refer to some other standard Add method?

I know this is asking a lot, but I have one other question. Most of the examples that I have seen for modifying events go through iterations to try and find what track is selected and what event on that track is selected. For my script, what if I know exactly the track that I want to add media to and it will always be track 3. Is there a simple way to write to add my media to track 3 without iterating through tracks? Thanks for your insight.
Back to top
View user's profile Send private message
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Fri Mar 21, 2008 3:08 am    Post subject: Reply with quote

It's just a matter of proper interpretation. For example, "Add" is not available as a "MediaPool" class because you can't add another "Media Pool". However, you CAN add more BINS so it is available in the "root media bin" which is the bottom-most bin.
Back to top
View user's profile Send private message Send e-mail
Edward Troxel
Site Admin


Joined: 14 Jul 2004
Posts: 5475

PostPosted: Fri Mar 21, 2008 3:15 am    Post subject: Reply with quote

saxman wrote:
I know this is asking a lot, but I have one other question. Most of the examples that I have seen for modifying events go through iterations to try and find what track is selected and what event on that track is selected. For my script, what if I know exactly the track that I want to add media to and it will always be track 3. Is there a simple way to write to add my media to track 3 without iterating through tracks? Thanks for your insight.


Certainly, you can definitely access tracks directly. For example, this code sets a variable to the third track:

Track myTrack = myVegas.Project.Tracks[2];
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    www.jetdv.com Forum Index -> Scripting FAQ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2.0.11 © 2001, 2002 phpBB Group