Split Script - is this possible?

NickHope wrote on 11/9/2007, 11:14 PM
I have a minor workflow issue that I think could be resolved with a small script.

I have a load of events on my timeline and I am editing them by either deleting them, ripple-dragging the ends, or spliting them with "S" on the keyboard.

The problem is that sometimes an event other than the one I want to split is selected, or the track view (timeline) is not selected at all. And so I have to physically click on the event I want to split (or above it) before hitting "S". This can make the cursor move slightly away from the frame-perfect position I wanted to split.

What I really want is a more powerful "split" command that I can program to a button on my Contour Shuttle Pro 2. I want it to split through all events at the cursor even if another window or another event is selected.

It looks like these would be the keyboard shortcuts to do such a thing:

ALT+0 = focus to track view
CTRL+SHIT+A = unselect all events
S = split

Is this possible? What would be the code?

Thanks

Comments

NickHope wrote on 11/10/2007, 4:23 AM
I've now done this as a macro on the Shuttle Pro, but I'd still be interested in a Vegas script option if it can be done.
Rosebud wrote on 11/10/2007, 5:18 AM
Try this one (save it at JS).
I wrote it very quickly so I’m not sure it works fine.


import System;
import System.Windows.Forms;
import Sony.Vegas;


try
{
var currentTrack : Track;
var currentEvent : TrackEvent;
var splittedEvent : TrackEvent;
var CursPos = Vegas.Cursor;
var group : TrackEventGroup;

for (currentTrack in Vegas.Project.Tracks)
{

for (currentEvent in currentTrack.Events)
{
if ((CursPos > currentEvent.Start) & (CursPos < (currentEvent.Start + currentEvent.Length)))
{
splittedEvent = currentEvent.Split ( CursPos - currentEvent.Start);

if (splittedEvent.IsGrouped)
{
group = splittedEvent.Group;
group.Remove(splittedEvent);
}
break;
}
}
}


} catch (e)
{
MessageBox.Show(e);
}
jetdv wrote on 11/10/2007, 5:26 AM
If you hold down the CTRL key when you select the event, it won't move the cursor.
NickHope wrote on 11/10/2007, 6:42 AM
Thanks for the tip jetdv. That's one of those things I used to know and then forgot.

Rosebud, the script works fine in 8.0a. I've mapped it to ALT+S as a global keyboard shortcut. Thanks very much! I've kept the Shuttle Pro macro on a button as well.

By the way are you still developing your "goto event" script?
NickHope wrote on 11/10/2007, 7:09 AM
Just noticed a small problem with the script Rosebud.

It leaves the 2 parts of the event grouped after splitting. Any way to fix that?
Rosebud wrote on 11/10/2007, 8:09 AM
I updated the script to remove the new splitted event from its initial group.
It should work as you want now, but if you want to keep the new splitted event grouped with its Audio or Video, it is a “bit more” complicated to do.

Sorry for the “GotoEvent script”. It’s in standby at this time.
I have a long multicam project to finish before to work on it.
NickHope wrote on 11/10/2007, 9:05 AM
Thanks for that Rosebud.

Really I would like the video and audio of the splitted event to remain grouped but no worries, I understand if it's time-consuming to do that. Likewise the "goto event" script. Good luck with the multicam project.