0

So at the moment I have plenty of words that are in the following format << some words >> and I have to manually select them, remove <<, >>, and make the word in italic by applying a character style. Would there be a way to do this with a hotkey on the current selection? I've already tried making up a GREP to do it, and I did, but not every word that's in that format should be changed, so I really need to do it manually, and a hotkey-ed script to do it on selection would be perfect. InDesign I'm using is CC 2015.

Predrag Beocanin
  • 1,402
  • 3
  • 18
  • 25

1 Answers1

1

Figured it out, pretty much this is how it works:

var mySel = app.selection[0]; // use selection
app.selection[0].contents = app.selection[0].contents.replace('<<', ''); // remove <<
app.selection[0].contents = app.selection[0].contents.replace('>>', ''); // remove >> 
var myCharacterStyle = app.activeDocument.characterStyles.item("Italic"); // grab character style named "Italic"
mySel.appliedCharacterStyle = myCharacterStyle; // Apply the character style to selection
Predrag Beocanin
  • 1,402
  • 3
  • 18
  • 25