This is something I did for my "Audion takes script"
eel:
Code:
function UserEditableValues()
(
//*//user feel free to adjust these
loopminimum=1.5; //ignore loops less than this size
setcolor=ColorToNative(55,187,55)|0x1000000; //Almost anoyying green color ;)
Mbuffvalue=1.2; //Default Media buffering is 1200ms
AfxValue=.2; //Default Anticipative FX Render Ahead is 200ms
);
UserEditableValues();
//set offset for marker
track= GetMediaItem_Track(GetSelectedMediaItem(proj, 0)); //get first track with items
Mbuff=GetMediaTrackInfo_Value(track, "I_PERFFLAGS")&1; //is Media Buffering enabled?
AFx=GetMediaTrackInfo_Value(track, "I_PERFFLAGS")&2; //is Anticipative FX enabled?
perftiming=(Mbuffvalue*abs(Mbuff-1))+(AFxvalue*(abs(AFx-2))/2);
slack=(GetOutputLatency()+ perftiming); //might be trying to be too smart here haha
A bit involved. there is a user configurable value here for media buffering size and anticipative FX size (also a check weather media buffering is enabled on the track) none of this may be necessary for what you want to do, you might just want to get the output latency and be done with it.
(this code involves looping so needs to be tight af)
then you make the marker from the (edit cursor?) minus the "slack" value..