Skip to main content
New Participant
March 17, 2019
Question

Script to redefine object, paragraph and character styles?

  • March 17, 2019
  • 1 reply
  • 824 views

Is there a script where I can redefine object, paragraph, and character styles in fell swoop?

Like for instance, if I resize the document then I get the point sizes in the parentheses. So I just want the script to select each style and choose to redefine the style to correct the point size. I basically want the script to select the style, “right-click” to refine it and move on.

I'm going to use this with the QuickReseize script by ID-Extras.com. In their script, once the objects have been resized they are redefined at 100%, but the styles are not redefined to the new settings.

Thanks for your help.

This topic has been closed for replies.

1 reply

Inspiring
March 18, 2019

Hi,

First, you should only need to change the font point size for paragraph styles. (Normally you would not change the size of characters inside a paragraph to be different than the paragraph style and the paragraph style that is part of an object style changes when its style is changed.) Below is a simple AppleScript that demonstrates. It has the user enter the new size for the paragraph styles. Here the point size for all styles change. If you want only certain styles to change you will need to add an if statement inside the repeat loop.

try

  tell application "Adobe InDesign CC 2019"

  tell document 1

  --get reference to all styles

  set allStyles to every paragraph style

  --drop the first style "No Paragraph Style" from the list

  set paraStyles to rest of allStyles

  --get the point size for the styles from the user

  set numberReturned to my getNumber("Enter point size for text", "10")

  --coerce number value to string and add " pts"

  set newPointSize to ("" & numberReturned & " pts")

  --repeat through paragraph styles and change size

  repeat with thisParastyle in paraStyles

  set point size of thisParastyle to newPointSize

  end repeat

  end tell

  end tell

on error errStr

  activate

  display alert errStr

end try

(*Handler gets number value from the user. Will error if non-number value is entered*)

on getNumber(thePrompt, dAnswer)

  set userResponse to display dialog thePrompt default answer dAnswer buttons {"OK", "Cancel"} default button 1

  set thisText to text returned of userResponse

  set numberValue to (0 + thisText)

  return numberValue

end getNumber

Hope this helps.