Created
November 18, 2014 10:34
-
-
Save grefel/3025f947c8c916603f27 to your computer and use it in GitHub Desktop.
Get String path for an #InDesign Style
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
var root = app.activeDocument; | |
var styleString = getStyleString(app.selection[0].appliedObjectStyle); | |
$.writeln(styleString); | |
function getStyleString(style) { | |
var nameArray = [style.name.replace(/:/g, '\\:')]; | |
while (style.parent.constructor.name.indexOf("StyleGroup") > -1) { | |
style = style.parent; | |
nameArray.push(style.name.replace(/:/g, '\\:')); | |
} | |
if (nameArray.length == 1) return nameArray[0]; | |
nameArray.reverse(); | |
return nameArray.join(":"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment