Skip to main content
Hey Evgenii
Inspiring
April 17, 2025
Answered

Pass objects to CEP context

  • April 17, 2025
  • 1 reply
  • 403 views

I am building cep extension and I was wondering if it is possible to pass from extendscript context object to CEP context and then pass it back to extendscript context? Eg:
extendscript [object TrackItem] -> CEP (here some operations happends with the callback data, but not with the object and its properties) -> extendscript [object TrackItem]

currently I am passing along needed data the object:
{

startTime: clip.start.seconds 
parentTrack: { trackType: "video", id: clip.parentTrackIndex },
}

using this object I am looping thought parent track and I am getting the clip object by start time. It works
but I am looking for ways to optimise the workflow (I cannot use indices due to some changes that happen on the timeline during the script run) 

maybe stringifing the object via JSON and parsing it back? 

p.s I am using both vanilla CEP and react bolt-cep

Thank you
Correct answer Bruce Bullis

I was wondering if it is possible to pass from extendscript context object to CEP context and then
> pass it back to extendscript context?


Anything passed between JavaScript and ExtendScript has to be flatted to a string, to make it across the boundary. 

>maybe stringifing the object via JSON and parsing it back?

Yep.

1 reply

Bruce Bullis
Bruce BullisCorrect answer
Legend
April 17, 2025

I was wondering if it is possible to pass from extendscript context object to CEP context and then
> pass it back to extendscript context?


Anything passed between JavaScript and ExtendScript has to be flatted to a string, to make it across the boundary. 

>maybe stringifing the object via JSON and parsing it back?

Yep.

Hey Evgenii
Inspiring
April 21, 2025

I have tried using JSON to send clip object back to cep panel and from there managed to recieve it as [object Object] with the readonly properties (no methods)


how can i convert it back to [object TrackItem]?

Bruce Bullis
Legend
April 21, 2025

I'm not sure you can; if you're trying to re-instantiate a trackItem from a bunch of JSON passed in from JavaScript, there's no guarantee that there will still be a corresponding trackItem available. 

Recommendation: Work with ExtendScript objects, within ExtendScript.