ExtendScript: How to remove conditions and how to apply them
Hi,
I do not have much time to rewrite my FrameScript scripts in ExtendScripts, but I have to. I see that FrameScript will not be supported forever.
In one of my scripts I have to remove conditions from a paragraph. It does not matter which conditions are there, and it does not matter, if not all of the paragraph has a condition.
In Rick's FrameAutomation blog he suggests this to remove all conditions from the text:
http://frameautomation.com/removing-conditions-from-text-and-table-rows-part-2/
#target framemaker
var doc = app.ActiveDoc;
var textRange = doc.TextSelection;
var prop = doc.GetTextPropVal (textRange.beg, Constants.FP_InCond);
// Remove all conditions from the text.
prop.propVal.osval.length = 0;
// Apply the updated list back to the text range.
doc.SetTextPropVal (textRange, prop);
When I create a short dummy file and apply a condition to the second to last paragraph, select this paragraph and copy this snippet into ESTK and run it, I get the following:
• The paragraph still has its condition.
• Now even the empty paragraph _after_ the selected paragraph has the condition!
What is correct? How can I remove all conditions from a paragraph?
Thank you very much for your help!
Best regards, Winfried

