ThumbnailAtMarker.js: Want to save with event name

MyNameIsJim wrote on 8/26/2009, 1:56 PM
I am using the old ThumbnailAtMarker.js script (thanks Edward!). Love it, but want to save the thumbnail jpg using the name of the file for the event. It can still enumerate incrementally, but want it to be "EventFilename001" instead of "Pic001".

I know how to enumerate through events, but this script enumerates through the markers, no the events. So I guess I need to add into the script a method to get the event name which is at the current marker location. How can I do this?

Thanks!

Comments

jetdv wrote on 8/26/2009, 4:04 PM
In the loop that goes through the markers, you then have to make another loop that goes through the events. Then you have to determine if that particular is under the marker you're looking at. If it is, there's your name. If it's not, you need to look at the next event. You can stop once you're past the marker.
MyNameIsJim wrote on 8/26/2009, 5:35 PM
OK, I know how to loop through the events. However I don't know how to determine if the current enumerated index of the event is before or beyond the enumerated index of the marker.

Ideas??
MyNameIsJim wrote on 8/28/2009, 2:46 PM
OK, I figured it out. The active take name is the key.

Need to loop thru events, get name of event active take, and then get the position of the start of the event, compare this against the current marker's position. If event position is past marker position, last name saved is the event under the marker. Below is the code I added to the original ThumbnailAtMarker.js.

Right after this line:
currMark = Marker(mrkEnum.item()).Position;

I added these lines:

var EventName;

while (!eventEnum.atEnd())
{
evnt = TrackEvent(eventEnum.item());
var pos;

if (evnt.Start > zeroMark) {
pos = evnt.Start;

// Determine if this position is past the current marker
// If so, we want to know the name of the event that preceeded this position
if (pos > currMark) {
break;
}
else
{
var activeTake;
activeTake = evnt.ActiveTake;
}

EventName = activeTake.Name;

}

eventEnum.moveNext();
}