Various aspects of Smart Styles can be scripted using JavaScript.
Examples are shown in this article.
Note: Knowledge of InDesign scripting is required.
Smart Styles extends the Asset and Library object.
Additional asset method:
- Property: applySmartStyle
- Parameters: Selection or (list of) PageItem(s)
- Returns: nothing
- What it does: Applies the asset as Smart Styles to the page item(s).
// This example applies the first item of the first library as Smart
// Style to the first page item of the active document
var myLib = app.libraries.item(0).assets.item(0);
var myItems = [app.activeDocument.pageItems.item(0)];
myLib.applySmartStyle( myItems );
Additional library property:
- Property: smartStyles
- Value type: Boolean
- Access: read/write
- What it is: Toggles the library between an Object and Smart Styles library.
// The script toggles the first library from Smart Styles to
// Object library or the other way around
if( app.libraries.item(0).smartStyles == false )
app.libraries.item(0).smartStyles = true;
else
app.libraries.item(0).smartStyles = false;
Comment
Do you have corrections or additional information about this article? Leave a comment! Do you have a question about what is described in this article? Please contact Support.
0 comments
Please sign in to leave a comment.