-
changing all take names (macro?)
Posted by Gilles Gagnon on July 22, 2013 at 5:06 pmHi Folks,
I have a project with Many takes. I want to give the project to an assistant where the assistant will select clips and “order” them on an excel sheet, after which, I will use this master list to create the final video.
Here’s what I need:
I need to give all my events on the timeline a successive number as an active take name. This number will display when the CTRL/SHIT/I shortcut key is pressed. My assistant will use these numbers as a referenceIs there a way to run a macro which will give all the clips an incremented number to achieve this?
Thanks!
Gilles
Matt Carlson replied 13 years, 1 month ago 4 Members · 13 Replies -
13 Replies
-
Roger Bansemer
July 22, 2013 at 7:13 pmI wish Vegas would let me do a batch rename on events too.
Roger Bansemer – PaintingAndTravel.com
-
Matt Carlson
July 23, 2013 at 3:19 amHere is a script but there are a few considerations…
Are all the events on the same track?
If not do you want the order to be track specific anyway?This script’s logic will order on per track basis and use the first events active name as the base + the count.
using System;
using Sony.Vegas;public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
const bool all = true;foreach (Track track in vegas.Project.Tracks)
{
string basename = track.Events[0].ActiveTake.Name;
int count = 1;
foreach(TrackEvent ev in track.Events)
{
if (all || ev.Selected)
{
ev.ActiveTake.Name = basename + count;
count++;
}
}
}
}
}If events are on multiple tracks it will get a bit trickier.
I put “const bool all = true;” in there so if you only wanted to do selected events you can change it to false.
-
Mike Kujbida
July 23, 2013 at 11:25 amGilles, you can do a bulk rename of all your files en masse in Windows Explorer or by using a free tool like IrfanView. Then, if you have Excalibur, there’s a tool (the name escapes me right now) to display all the file names on screen as if you titled each one. Render that out for your assistant.
-
Gilles Gagnon
July 23, 2013 at 12:35 pmThanks Mike. This is a very good idea.
However, I need the clips incrementally numbered as they are in the project. At the moment, this order does not match the order in windows explorer as I have moved some clips around.Also, I’m not rendering for the assistant. She’s using the .veg file to work from. (and I don’t have excalibur)
Matt’s macro may just do the trick 🙂
Thanks for the suggestion though.Gilles
-
Gilles Gagnon
July 23, 2013 at 12:38 pmHi Matt,
thanks for this brilliant solution! It looks like it’ll do the trick. I’ll give it a try and report back any issues.
Thanks a bunch!
GGilles
-
Gilles Gagnon
July 23, 2013 at 8:13 pmHi Matt,
thanks for this! IT looked promising but I just attempted running it and bombed. I received this error. Any ideas?System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at Sony.Vegas.BaseList`1.CheckItemRange(Int32 index)
at Sony.Vegas.BaseList`1.get_Item(Int32 index)
at EntryPoint.FromVegas(Vegas vegas)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sony.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
at Sony.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)Gilles
-
Gilles Gagnon
July 23, 2013 at 8:31 pmHi again Matt, more info.
I tried it on a three-event single track test project and it worked, somewhat. I changed the name of the first take to “1” (no quotes), ran the script and it did rename the the takes but starting at “11”, not “1”.The error still occurs in the multitrack project I want to use this on.
any ideas?
Gilles
-
Matt Carlson
July 24, 2013 at 3:22 amI will look in to the errors… not sure why Reflection is having such a fit on a simple script.
As for naming if you want the first event to be “1” just have the first event name be blank.
The naming goes like this: first Event Name + number.
So if your first event is named Final the names will be: Final1, Final2, etc.
By naming the first event “1” you get names: 11, 12, 13… 110,111 etc because it is “1” + count;
Do you need the audio events named as well? I could just make the script skip audio tracks.
-
Matt Carlson
July 24, 2013 at 3:40 amAh the perils of scripting late at night….
The last script will error if any tracks are empty of events.This one should be fine but you mentioned your actual project has multiple tracks. Numbering events in order over multiple tracks is a more complicated script. Do you need that?
using System;
using Sony.Vegas;using System;
using Sony.Vegas;public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
const bool all = true;foreach (Track track in vegas.Project.Tracks)
{
string basename = "";
if (track.Events.Count > 0)
basename = track.Events[0].ActiveTake.Name;
int count = 1;
foreach(TrackEvent ev in track.Events)
{
if (all || ev.Selected)
{
ev.ActiveTake.Name = basename + count;
count++;
}
}
}
}
} -
Matt Carlson
July 24, 2013 at 4:34 am…. and finally this script will number by order of event start times over multiple tracks.
It also works on a project with a single video track but in either case only video events are numbered which I believe will be fine for what you need.
using System;
using System.Collections.Generic;
using Sony.Vegas;public class EntryPoint
{
public void FromVegas(Vegas vegas)
{
List OrderedEvents = new List();
bool all = true;foreach (Track track in vegas.Project.Tracks)
{
if (track.IsAudio()) continue;
foreach (TrackEvent ev in track.Events)
{
if (all || ev.Selected)
{
OrderedEvents.Add(ev);
OrderedEvents.Sort(delegate (TrackEvent e1, TrackEvent e2)
{
return e1.Start.CompareTo(e2.Start);
});
}
}
}
int count = 1;
string basename = OrderedEvents[0].ActiveTake.Name;foreach (TrackEvent ev in OrderedEvents)
{
ev.ActiveTake.Name = basename + count;
count++;
}
}
}
Reply to this Discussion! Login or Sign Up