Do you mean, your JS contains a string like
var a = "<ps:hello>Hello world<ps:>";
and you want ID to automatically parse the tags? That's not possible; at least, not the way you think. Parsing Tagged Text only happens on importing ("placing") from a file -- I don't think there is a way to fool ID into thinking it's reading from a file.
You can, of course, simply save the string into a file and place that -- I never tried it, but I s'pose ID will have no problems with that.
An alternative is writing your string into a text frame "as is" and use scripting to find the tags and replace them with the appropriate formatting.
Thanx for the quick answer...
I already suspected, that there's no easy way out of this, arghh!
I think, I'll try it with an external lookup table (txt file), something like the following, after I have parsed the content of the story for start and end position:
app.selection.parentStory.characters.itemByRange(start,end).fillColor = "Red";
app.selection.parentStory.characters.itemByRange(start,end).fillColor = "Green";
Unfortunately this will slow down the whole process, switching the TaggedText filter on and off would have been much more effective... the heck with it.
Thank you anyway,