Skip to main content
Known Participant
April 25, 2024
Answered

Getting/setting Mark In/Mark Out points in project item opened in source monitor

  • April 25, 2024
  • 1 reply
  • 1868 views

Pinging @Bruce Bullis because I'm pretty sure you're the man I want 😉

 

Like the title says, I would like to programatically "Mark In" and "Mark Out" (keyboard shortcuts I and O) in a project item opened in source monitor. I find the correct project item to open in source monitor by comparing the file path like so:

if (projItem.name.toLowerCase() === videoFileName.toLowerCase()) {
app.sourceMonitor.openProjectItem(projItem)
}

And would now like to also set the in and out points by given timestamps. I see that it's possible for a sequence, in e.g. the `exportCurrentFrameAsPNG` function in the PProPanel project:

var seq = app.project.activeSequence;
..
seq.setInPoint(currentTime.seconds);

 

Is there any way to use Markers perhaps? I'm already setting markers to a project item which are shown as expected when opening the video in source monitor.

 

Thankful for any guidance!

This topic has been closed for replies.
Correct answer Bruce Bullis

Once you've found a projectItem associated with the media open in the source monitor (your approach is sound), you can use projectItem.setInPoint() and .setOutPoint().

 

1 reply

Bruce Bullis
Bruce BullisCorrect answer
Legend
April 25, 2024

Once you've found a projectItem associated with the media open in the source monitor (your approach is sound), you can use projectItem.setInPoint() and .setOutPoint().

 

Known Participant
April 26, 2024

Thank you for the quick reply! Unfortunately I am not getting it to work. I can fetch the in and out points of the project item, but setting them gives me an error. Not sure what I am doing wrong? See code snippet below:

if (projItem.name.toLowerCase() === videoFileName.toLowerCase()) {
    app.sourceMonitor.openProjectItem(projItem);
    var inPoint = projItem.getInPoint(); // works fine, returns Time object at 0 seconds
    var outPoint = projItem.getOutPoint(); // works fine, Time object at ~14000 seconds (3.5h+ video)
    inPoint.seconds = 600; // confirmed inPoint was modified to 600s, i.e. 10min in
    outPoint.seconds = 1200; // confirmed outPoint was modified to 1200s, i.e. 20min in

    // projItem.setInPoint(inPoint.ticks); // EvalScript Error
    // projItem.setOutPoint(outPoint.ticks);  // EvalScript Error

    // projItem.setInPoint(inPoint.seconds); // EvalScript Error
    // projItem.setOutPoint(outPoint.seconds);  // EvalScript Error

    // projItem.setInPoint(inPoint); // EvalScript Error
    // projItem.setOutPoint(outPoint);  // EvalScript Error
}
Bruce Bullis
Legend
April 26, 2024

Have you stepped through that ExtendScript code in the VSCode ExtendScript Debugger? 

I ask, because it gave me a more informational error message (than just 'EvalScript Error'), which showed the actual problem... 😉

 

 

 

 

The docs for setInPoint() explain the second, non-optional parameter:

 

 

 

 

 

 

This code (which just acts on the first projectItem it finds) works. 

 

 

var first = app.project.rootItem.children[0];
if (first){
	var inpoint	= first.getInPoint();
	inpoint.seconds = 16.234;
	var result = first.setInPoint(inpoint, 4);
}