InDesign CS5.5 - Nested Styles

Hi

I have previously used a script to create a nested style, but I can’t get it working now. Does anyone know why?

  • This is the part that creates the error: (The paragraph and character styles are created - the problem is to have the paragraph accept the nested style)

The error I get is Invalid value for set property “applied character style”, expected character or string received “telefon” (the name of my character style)

-- paragraph style for alt tekst
		try
			set myParagraphStyle_2 to paragraph style "adresse"
		on error
			set myParagraphStyle_2 to make paragraph style
			tell myParagraphStyle_2
				set myParagraphStyle_2 to "address"
				set name to "address"
				set applied font to "Bell Gothic Std" & tab & "Black"
				set point size to 6
				set leading to 6.4
				set fill color to "Black"
				set left indent to 4
				set myTab to make tab stop
				set alignment of myTab to right align
				set leader of myTab to "."
				set position of myTab to 192
				set myNested to make nested style
				-- set applied character style of myNested to myCharacterStyle    * this is the error
				set delimiter of myNested to tabs
				set inclusive of myNested to true
				set repetition of myNested to 1
			end tell
		end try

Thanks
Fernando

It may be a problem with referring to the character style within the tell paragraph style block. Try ending the block after setting the tab position and then do something like:

set myNested to make nested style at myParagraphStyle_2  with properties {applied character style:myCharacterStyle}

Nope, that didn’t worked. The error message is: Can’t make class nested style

I’ve also tried (outside the tell block, but inside the try block):

tell myParagraphStyle_2
			set myNestedStyle to make nested style with properties {applied character style:myCharacterStyle, delimiter:tabs, inclusive:true, repetition:1}
		end tell

that retrieves the error message “address” doens’t understand the make message

The funny thing is that the following code inside the original tell block creates the nested style, but doesn’t apply the character style.

set position of myTab to 192
set myNested to make nested style
-- set applied character style of myNested to myCharacterStyle
set delimiter of myNested to tabs
set inclusive of myNested to true
set repetition of myNested to 1

Thanks anyway

I’m not sure what you’re doing, but this works fine here:

tell application id "com.adobe.InDesign" -- Adobe InDesign CS5.5.app
	tell document 1
		try
			set myParagraphStyle_2 to paragraph style "adresse"
		on error
			set myCharacterStyle to character style "test"
			set myParagraphStyle_2 to make paragraph style
			tell myParagraphStyle_2
				-- set myParagraphStyle_2 to "address" -- delete this
				set name to "address"
				set point size to 6
				set leading to 6.4
				set fill color to "Black"
				set left indent to 4
				set myTab to make tab stop
				set alignment of myTab to right align
				set leader of myTab to "."
				set position of myTab to 192
			end tell
			set myNested to make nested style at myParagraphStyle_2 with properties {applied character style:myCharacterStyle}
		end try
	end tell
end tell

Oh, thank you, thank you very much.

I can see that you also used this line

set myCharacterStyle to character style "test"

I didn’t have it implemented in my solution, and that actually did the trick.

Thanks again

Fernando