Mogrt getValue returns JSON in Extendscript
Premier Pro V 12.1
I made a simple mogrt in Premier Pro and then saved it as a mogrt template and inserted it on the timeline.
It just contains a text field with a rectangle background.
I want to change the text of the mogrt by extendscript.
However when I try to do that in Extendscript using
seq.videoTracks[0].clips[0].components[2].properties.getParamForDisplayName("Source Text").setValue("Test Text");
the mogrt on the timeline just loses its existing text. I mean the text just vanished only the background stays.
To debug the issue I tried reading the value of the mogrt using
var obj = seq.videoTracks[0].clips[0].components[2].properties.getParamForDisplayName("Source Text").getValue();however here I get some kind of json value when I look at obj using
$.writeln(JSON.stringify(obj));
The printed output is like this for
"ऒ\u0000\u0000\u0000{\"mTextParam\":{\"mAlignment\":0,\"mDefaultRun\":[],\"mHeight\":0,\"mHindiDigits\":true,\"mIndic\":true,\"mIsVerticalText\":false,\"mLeading\":0,\"mLigatures\":true,\"mRTL\":false,\"mShadowAngle\":135,\"mShadowBlur\":40,\"mShadowColor\":4144959,\"mShadowOffset\":7,\"mShadowOpacity\":75,\"mShadowSize\":0,\"mShadowVisible\":false,\"mStyleSheet\":{\"mBaselineOption\":{\"mParamValues\":[[0,0]]},\"mBaselineShift\":{\"mParamValues\":[[0,0]]},\"mCapsOption\":{\"mParamValues\":[[0,0]]},\"mFauxBold\":{\"mParamValues\":[[0,false]]},\"mFauxItalic\":{\"mParamValues\":[[0,false]]},\"mFillColor\":{\"mParamValues\":[[0,16777215],[10,16745993],[11,16745993],[12,16745993],[13,16745993],[14,16745993],[15,16745993],[16,16777215]]},\"mFillOverStroke\":{\"mParamValues\":[[0,true]]},\"mFillVisible\":{\"mParamValues\":[[0,true]]},\"mFontName\":{\"mParamValues\":[[0,\"Assistant-SemiBold\"]]},\"mFontSize\":{\"mParamValues\":[[0,140]]},\"mKerning\":{\"mParamValues\":[[0,0]]},\"mStrokeColor\":{\"mParamValues\":[[0,16777215]]},\"mStrokeVisible\":{\"mParamValues\":[[0,false]]},\"mStrokeWidth\":{\"mParamValues\":[[0,1]]},\"mText\":\"This is a sample text\",\"mTracking\":{\"mParamValues\":[[0,0]]},\"mTsumi\":{\"mParamValues\":[[0,0]]}},\"mTabWidth\":400,\"mWidth\":0},\"mVersion\":1}"I don't understand what are those extra characters at the start of the json, it has some indic character and 3 Nul characters, due to which JSON.parse() throws an exception.
Can we use this JSON and modify the text string of the mogrt? Or is there any other way to achieve this?
