I want to put a character style highlight on a text variable
Hi
I wonder if anyone can help, I'm trying to write a script where I can insert a text varible and also give it a character style highlight so it can be easily seen.
This is what I've been trying which does seem to work but I can't believe this is the way to do it
var itemVariable = app.selection[0].textVariableInstances.add({associatedTextVariable:selectedVariable});
var myTextFrame = app.selection[0].parentTextFrames[0];
var styleStartIndex = app.selection[0].index - 1;
var styleEndIndex = styleStartIndex + 1;
app.selection[0].characters.itemByRange(styleStartIndex, styleEndIndex).appliedCharacterStyle = doc.characterStyles.itemByName("Pink");Thanks in advance
Alex
