I got this working with the following script (had to point to the right action var)
action = comp(“Comp 1”).layer(“Marker”);
n = 0;
//test = action.marker.numKeys;
if (action.marker.numKeys > 0){
n = action.marker.nearestKey(time).index;
if (action.marker.key(n).time > time){
n–;
}
}
if (n == 0){
0
}else{
m = action.marker.key(n);
myComment = m.comment;
test = myComment;
t = time – m.time;
}
try{
actMarker = action.marker.key(myComment);
if (action.marker.numKeys > actMarker.index){
tMax = action.marker.key(actMarker.index + 1).time – actMarker.time;
}else{
tMax = action.outPoint – actMarker.time;
}
t = Math.min(t, tMax);
actMarker.time + t;
}catch (err){
0
}