Page 1 of 1

Check if marker exists

Posted: July 2nd, 2013, 10:40 am
by ernpchan
Is it possible to check if a marker exists where the Current Time Indicator is?

Re: Check if marker exists

Posted: July 2nd, 2013, 2:28 pm
by Paul Tuersley
Scripting only has access to layer markers, not comp markers. Here's an example that will find if there's a layer marker at the current time when one layer is selected in a comp:

Code: Select all

var activeItem = app.project.activeItem;
if (activeItem instanceof CompItem && activeItem.selectedLayers.length == 1) {

	var theLayer = activeItem.selectedLayers[0];
	var markerProp = theLayer.property("ADBE Marker");

	if (markerProp.numKeys > 0) {
		if (markerProp.keyTime(markerProp.nearestKeyIndex(activeItem.time)) == activeItem.time) {
			alert("There's a marker on this frame");
		} else {
			alert("No marker on this frame");
		}
	}
}