Excuse me, the post was published by mistake while I was still writing it. It's incomplete but now I can't modify it. So I repeat and correct the question. I have a for loop that add text to var and I need to map it with styles, something like this: var myText = ''; var content = { 'one': 'lorem ipsum', 'two': 'dolor sit amet', 'three' : 'consectetur adipiscing elit' 'four' : 'Mauris ut sem id nisi malesuada', } for(key in content){ if(key=='one'){ myText += content[key] //and map with character style styleONE }else if(key == 'two'){ myText += content[key] //and map with character style styleTWO } ....etc } var myTextFrame = app.selection[0].insertionPoints[0]; myTextFrame = myText; So I would to create the var string already mapped with styles and then write it to a text Frame. Actualy I'm doing this var myTextFrame = app.selection[0].insertionPoints[0]; myTextFrame = ' '; var content = { 'one': 'lorem ipsum', 'two': 'dolor sit amet', 'three' : 'consectetur adipiscing elit' 'four' : 'Mauris ut sem id nisi malesuada', } for(key in content){ if(key=='one'){ myTextFrame.parentStory.characters.item(-1).applyCharacterStyle(styleONE,true); myTextFrame.parentStory.insertionPoints.item(-1).contents=content[key]; } ....etc } I think it would be amazing if I could map text like html or xml <charStyle class="one">lorem ipsum</charStyle> <charStyle class="two">dolor sit amet</charStyle> Is it possible?
... View more