Check if marker exists

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
ernpchan
Posts: 56
Joined: February 8th, 2010, 11:27 pm

Is it possible to check if a marker exists where the Current Time Indicator is?
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

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");
		}
	}
}
    
Post Reply