• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Creating Styles.. and then nesting styles

Participant ,
Dec 10, 2012 Dec 10, 2012

Copy link to clipboard

Copied

Seems simple enough:

tell application "Adobe InDesign CS5.5"

tell active document

  set myCharacterStyle to make character style with properties {name:"Year", size:26.0, fill color:"Paper", stroke color:"Black", stroke weight:0.75, font:"Helvetica", font style:"Black"}

 

  set myCharacterStyle to make character style with properties {name:"Years", size:18.0, fill color:"Black", stroke color:nothing, stroke weight:nothing, horizontal scale:80.0, vertical scale:80.0, font:"Helvetica", font style:"Black"}

 

  set myParagraphStyle to make paragraph style with properties {name:"Year"}

  set nested styles of myParagraphStyle to {{applied character style:"Year", repetition:1, inclusive:false, delimiter:any word}, {applied character style:"Years", repetition:2, inclusive:true, delimiter:any word}}

 

end tell

end tell

The font and the point size do not come through when the style is created. The nested styles also do not come through.

I tried applied font:"Helvetica" to get 'font family not available'. Also, font:font "Helvetica"...

What I get right now I is no font defined or size. The rest works.

So what am I doing wrong here?


TOPICS
Scripting

Views

982

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Dec 10, 2012 Dec 10, 2012

Hi lithodora,

as Mary Posner wrote a character style doesn't have the property 'font', but 'applied font' and 'font style'.

"... specified as either a font object or the name of font family."

just look it up in the dictionary ...

Try always to work with references.

tell application "Adobe InDesign CS5.5"

    --you've got to set myHelvetica to your needs!

    set myHelveticas to (font family of every font whose name contains "Helvetica") --will return the helvetica font familiy names

    set myHelvetica

...

Votes

Translate

Translate
Engaged ,
Dec 10, 2012 Dec 10, 2012

Copy link to clipboard

Copied

Try this:

applied font: "Helvetica     Black"

Note that there's a tab between the font name and the font style. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 10, 2012 Dec 10, 2012

Copy link to clipboard

Copied

Hi lithodora,

as Mary Posner wrote a character style doesn't have the property 'font', but 'applied font' and 'font style'.

"... specified as either a font object or the name of font family."

just look it up in the dictionary ...

Try always to work with references.

tell application "Adobe InDesign CS5.5"

    --you've got to set myHelvetica to your needs!

    set myHelveticas to (font family of every font whose name contains "Helvetica") --will return the helvetica font familiy names

    set myHelvetica to item 1 of myHelveticas --just randomly pick one for my example, hoping it's got a 'black' style 😉 ...

   

    tell active document

        set myCharacterStyle01 to make character style with properties {name:"test", size:26.0, fill color:"Paper", stroke color:"Black", stroke weight:0.75, applied font:myHelvetica, font style:"Black"}

        set myCharacterStyle02 to make character style with properties {name:"tests", size:18.0, fill color:"Black", stroke color:nothing, stroke weight:nothing, horizontal scale:80.0, vertical scale:80.0, applied font:myHelvetica, font style:"Black"}

       

        set myParagraphStyle to make paragraph style with properties {name:"nextTest"}

       

        tell myParagraphStyle

            make new nested style with properties {applied character style:myCharacterStyle01, repetition:1, inclusive:false, delimiter:any word}

            make new nested style with properties {applied character style:myCharacterStyle02, repetition:2, inclusive:true, delimiter:any word}

        end tell

       

    end tell

   

end tell


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 11, 2012 Dec 11, 2012

Copy link to clipboard

Copied

LATEST

Thank you for the help!

I had tried the applied font first, but had changed my approach due to the properties returned of the existing style. It didn't have a property for applied font, but did have font. That is why I had gone that way.

Rather than use a repeat to step through every Helvetica till I come up with one that works I have followed what Mary posted which works. I can't believe I forgot to use the Tab.

Again, thank you both for the help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines