Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
SONY VEGAS: Sony Vegas TutorialsSony Vegas ForumArticlesBasics ForumBlack Magic Design ForumAJA Xena Forum

Re: macro?

Cow Forums : Sony Vegas
VIEW POSTS   •   ADD A NEW POST   •   SEARCH   •   CHANGE FORUM
Respond to this post   •   Return to posts index   •   Read entire thread


Re: macro?
by Robbie Knight on Jun 22, 2008 at 9:35:30 pm

the same talented brother of mine gave me this version 2 of his script, helping me with naming and putting the subclips in a specific folder...

the trouble is, these scripts make something odd happen to vegas, occasionally the script won't finish and vegas will tell me an exception has occurred,

then i try and load the same file (saved after i had done a script or 2) and it won't load...

gets to 85%, 90%, or 94% and fails, "an exception has occurred" again...

so clearly there's something not right with my brothers scripts, (and it is his 1st time writing them), i know it's a lot to ask, but does anything strike anyone in the code?

thanks again x


/**

* You can use this script to convert Vegas regions to subclips. It will only work with saved projects.

*

* To use this script:

*

* 1) Create named Vegas regions.

* 2) Confirm no overlapped regions.

* 3) Vegas>tools>scripting>run script>Convert Regions To Subclips.cs

* 4) Check Project Media to see the subclips

*

* Revision Date: June 22, 2008.

**/

using System;

using System.IO;

using System.Text;

using System.Collections;

using System.Windows.Forms;

using System.Globalization;

using Sony.Vegas;



public class EntryPoint

{

Vegas myVegas;



public void FromVegas(Vegas vegas) {

myVegas = vegas;



String projName;



String projFile = myVegas.Project.FilePath;

if ((null == projFile) || (String.Empty == projFile)) {

projName = "Untitled";

} else {

projName = Path.GetFileNameWithoutExtension(projFile);

}



ConvertRegionsToSubclips();

}



void ConvertRegionsToSubclips() {

try {

/* foreach (Media media in myVegas.Project.MediaPool)

{

foreach (Region region in media.Regions)

{

//MessageBox.Show(media.FilePath);

//MessageBox.Show(region.Label);

Subclip subclip = new Subclip(myVegas.Project.FilePath, region.Position, region.Length, false, region.Label);

}

}*/

if (myVegas.Project.FilePath.Equals(""))

MessageBox.Show("Please save project before running this script");

else

{

MediaBin InOrderBin = myVegas.Project.MediaPool.RootMediaBin;

bool foundIt = false;

foreach (MediaBin bin in myVegas.Project.MediaPool.RootMediaBin)

{

if (bin.Name.Equals("in order"))

{

InOrderBin = bin;

foundIt = true;

}

}

if (foundIt)

{

String suffix = "";

foreach (Region region in myVegas.Project.Regions)

{

//MessageBox.Show(myVegas.Project.FilePath);

//MessageBox.Show(region.Label);

String subclipLabel;

if (suffix.Equals(""))

{

subclipLabel = region.Label;

suffix = region.Label.Substring(1);

}

else

subclipLabel = region.Label + suffix;

Subclip subclip = new Subclip(myVegas.Project.FilePath, region.Position, region.Length, false, subclipLabel);

InOrderBin.Add(subclip);

}

}

else

{

MessageBox.Show("Cannot find media bin "in order"");

}

}

} finally {

}

}

}




Respond to this post   •   Return to posts index   •   Read entire thread


Current Message Thread:
  • macro? by Robbie Knight on Jun 17, 2008 at 12:20:40 am
    • Re: macro? by Edward Troxel on Jun 17, 2008 at 12:46:56 pm
      • Re: macro? by Robbie Knight on Jun 18, 2008 at 2:11:20 am
        • Re: macro? by Edward Troxel on Jun 18, 2008 at 12:34:45 pm
          • Re: macro? by Robbie Knight on Jun 18, 2008 at 4:14:00 pm
      • Re: macro? by Robbie Knight on Jun 22, 2008 at 6:17:24 pm
        • Re: macro? by Robbie Knight on Jun 22, 2008 at 9:35:30 pm
          • Re: macro? by Jill Simpson on Nov 21, 2008 at 6:32:39 pm


Related Threads:
Key Macros   |   News: Adobe to acquire Macromedia



Note: If you are a registered user please click here to login before posting.

Your post will not be accepted if your name and email address are not registered in our database. Click here if you do not have an account.

Name
E-Mail Address
Subject
E-Mail me when someone responds
Just This Message   Entire Thread   None  

Message:

Add Bold Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this buttonAdd Italic Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this buttonAdd Underline Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this buttonAdd Image Link Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this buttonAdd URL Link Tag To Message (JavaScript required)

To put any item inside this tag:

1. Highlight the desired text
2.Click this button

Note: The following are HTML characters and may cause parts of your post to disappear if not used correctly: < > &
To include any portion of the post in your response, highlight the desired text and hit the "Q" key. Read more...



Add your message signature


 


Note: By clicking "Post Direct" button above, you are agreeing to the Creative Cow's Code of Conduct.



FORUMSTUTORIALSMAGAZINEDVDsBOOKSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]