Text from Markers

Display text from the nearest layer marker comment.

Expression Code

// Text from Markers
// Apply to Source Text
// Add markers to this layer with comment text

n = 0;
if (marker.numKeys > 0) {
  n = marker.nearestKey(time).index;
  if (marker.key(n).time > time) {
    n--;
  }
}

if (n > 0) {
  marker.key(n).comment;
} else {
  "";   // Default text before first marker
}
Add markers to the layer and put your text in the marker comments. The expression displays whichever marker comment is currently active based on the playhead position.