Insert text after a specific text (top insertion point of page)
Hello guys,
How can add a flag (a simple text) on top of page after a specific flag (unique piece of text). Let me try to explain:
I am inserting a flag on top of a each page of document.
var myText={flag1};
myDoc.pages.textFrames.itemByName("main").insertionPoints.item(0).properties = { appliedCharacterStyle : "pbBlank_CS", contents:myText};
In second go, I am again inserting another flag on top of pages:
var myText={flag2};
myDoc.pages.textFrames.itemByName("main").insertionPoints.item(0).properties = { appliedCharacterStyle : "pbBlank_CS", contents:myText};
The order I am expecting should be
{flag1}{flag2} but on some pages it appears in reverse form
{flag2}{flag1} which is not expected. I am thinking following way to keep the correct order:
1. Finding "}" on top , like {flag1} text start text start .............. and then inserting my second flag {flag2} to it to get the correct order {flag1}{flag2} text start text start.
The reason why I would like to search for last "}" as there may as many as flags need added to top of page something like {flag1}{flag2}{flag3}{flag4} etc. This will ensure me to have the correct order.
Hope I am making sense.
Any thoughts in this regard will be highly appreciated.
Regards,
--PC