Reply To: Changing the name of every style in a document

Home Page / Forums / General InDesign Topics (CLOSED) / Changing the name of every style in a document / Reply To: Changing the name of every style in a document

#53044

OK, rather than try and map the new styles to the old ones automatically (how would ID know which ones to use?), I'm playing with the idea of creating a dialog box for each paragraph style in the document in turn, so I can type in the new name.  (Yes, I know I've probably already taken more time than it would take to click on each style manually, but I've never written a script with a dialog in it before so I thought I'd take the opportunity to learn.)

I've adapted one of the examples in the Applescript tutorial.  So far I have:

tell application “Adobe InDesign CS5”

tell active document

set allParaStyles to every paragraph style

repeat with i from 1 to count of allParaStyles

set myParaStyle to item i of allParaStyles

set myOldStyleName to name of myParaStyle

set myDialog to make dialog

tell myDialog

set name to “Rename paragraph style”

set myDialogColumn to make dialog column

tell myDialogColumn

–Create a text entry field.

set myNewStyleName to make text editbox with properties {edit contents:”myOldStyleName”, min width:180}

end tell

end tell

set myResult to show myDialog

if myResult is true then

–Get the settings from the dialog box.

set name of myParaStyle to edit value of myNewStyleName

–Remove the dialog box from memory.

destroy myDialog

else

destroy myDialog

end if

end repeat

end tell

end tell

But this gives me an error:

error “Adobe InDesign CS5 got an error: Can’t make class dialog.” number -2710 from dialog to class

What am I missing?

This article was last modified on June 10, 2010

Comments (0)

Loading comments...