Created
June 1, 2018 12:23
-
-
Save v-zhuravlev/fda7177029360ffa1ca937d9bcc0f3b7 to your computer and use it in GitHub Desktop.
color boxes in InDesign with js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (parseFloat(app.version) > 6) | |
main(); | |
else | |
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Color Textboxes Based on Word"); | |
function main() { | |
var red = app.activeDocument.colors.itemByName("RGB Red"); | |
var blue = app.activeDocument.colors.itemByName("RGB Blue"); | |
var sel = app.selection; | |
for(s=0;s<sel.length;s++){ | |
var cont = sel[s].parentStory.words | |
for(w=0;w<cont.length;w++){ | |
//if statement will need to be copy/pasted for each additional word formatting | |
if(cont[w].contents.toUpperCase() == "EVP"){ | |
sel[s].fillColor = red; | |
} | |
if(cont[w].contents.toUpperCase() == "DEAL"){ | |
sel[s].fillColor = blue; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment