Copy link to clipboard
Copied
Dear All,
I have a big project that has around 4000 pages.
The indd files include 29 paragraph styles that are in English, and I would like to change some attribute in the paragraph styles like direction, composer, and so on.
I am aware that I can use InDesign's find and replace feature, but it's for 1 by 1 par. Styles only. Is there any script that can search in multi paragraph styles at once?
I would like you help in this really, because it will save a lot of times of repeated steps.
Well you can do that by first getting a reference to the ParagraphStyle, and then settings the properties. Here's the ParagraphStyle documentation.
Here is some code that gets a reference to a paragraph style and then sets some of its properties:
var doc = app.activeDocument,
myParagraphStyle = doc.paragraphStyles.itemByName('My Paragraph Style');
// example of changing some properties
myParagraphStyle.properties = {
composer: 'Adobe Paragraph Composer',
characterDirection: Charac
...
Copy link to clipboard
Copied
Hi @Amr.Hamdy Do you just want to edit the paragraph style to change direction, composer etc? That will apply to any paragraphs with that style in most cases.
- Mark
Copy link to clipboard
Copied
Hello Mark,
Yes, I need only change the attributs in Paragraph Styles like Composer, Font Size, Direction, Hyphnation, etc.
Copy link to clipboard
Copied
Well you can do that by first getting a reference to the ParagraphStyle, and then settings the properties. Here's the ParagraphStyle documentation.
Here is some code that gets a reference to a paragraph style and then sets some of its properties:
var doc = app.activeDocument,
myParagraphStyle = doc.paragraphStyles.itemByName('My Paragraph Style');
// example of changing some properties
myParagraphStyle.properties = {
composer: 'Adobe Paragraph Composer',
characterDirection: CharacterDirectionOptions.RIGHT_TO_LEFT_DIRECTION,
hypenation: false,
pointSize: 11,
}
/*
Properties of ParagraphStyle:
• alignToBaseline
• allowArbitraryHyphenation
• appliedFont
• appliedLanguage
• appliedNumberingList
• autoLeading
• autoTcy
• autoTcyIncludeRoman
• balanceRaggedLines
• basedOn
• baselineShift
• bulletChar
• bulletsAlignment
• bulletsAndNumberingListType
• bulletsCharacterStyle
• bulletsTextAfter
• bunriKinshi
• capitalization
• characterAlignment
• characterDirection
• characterRotation
• cjkGridTracking
• composer
• designAxes
• desiredGlyphScaling
• desiredLetterSpacing
• desiredWordSpacing
• diacriticPosition
• digitsType
• dropCapCharacters
• dropCapLines
• dropCapStyle
• dropcapDetail
• emitCss
• endJoin
• eventListeners
• events
• fillColor
• fillTint
• firstLineIndent
• fontStyle
• glyphForm
• gradientFillAngle
• gradientFillLength
• gradientFillStart
• gradientStrokeAngle
• gradientStrokeLength
• gradientStrokeStart
• gridAlignFirstLineOnly
• gridAlignment
• gridGyoudori
• horizontalScale
• hyphenWeight
• hyphenateAcrossColumns
• hyphenateAfterFirst
• hyphenateBeforeLast
• hyphenateCapitalizedWords
• hyphenateLadderLimit
• hyphenateLastWord
• hyphenateWordsLongerThan
• hyphenation
• hyphenationZone
• ignoreEdgeAlignment
• imported
• includeClass
• jidori
• justification
• kashidas
• keepAllLinesTogether
• keepFirstLines
• keepLastLines
• keepLinesTogether
• keepRuleAboveInFrame
• keepWithNext
• keepWithPrevious
• kentenAlignment
• kentenCharacterSet
• kentenCustomCharacter
• kentenFillColor
• kentenFont
• kentenFontSize
• kentenFontStyle
• kentenKind
• kentenOverprintFill
• kentenOverprintStroke
• kentenPlacement
• kentenPosition
• kentenStrokeColor
• kentenStrokeTint
• kentenTint
• kentenWeight
• kentenXScale
• kentenYScale
• kerningMethod
• keyboardDirection
• kinsokuHangType
• kinsokuSet
• kinsokuType
• label
• lastLineIndent
• leading
• leadingAki
• leadingModel
• leftIndent
• ligatures
• maximumGlyphScaling
• maximumLetterSpacing
• maximumWordSpacing
• mergeConsecutiveParaBorders
• minimumGlyphScaling
• minimumLetterSpacing
• minimumWordSpacing
• miterLimit
• mojikumi
• name
• nestedGrepStyles
• nestedLineStyles
• nestedStyles
• nextStyle
• noBreak
• numberingAlignment
• numberingApplyRestartPolicy
• numberingCharacterStyle
• numberingContinue
• numberingExpression
• numberingFormat
• numberingLevel
• numberingRestartPolicies
• numberingStartAt
• otfContextualAlternate
• otfDiscretionaryLigature
• otfFigureStyle
• otfFraction
• otfHVKana
• otfHistorical
• otfJustificationAlternate
• otfLocale
• otfMark
• otfOrdinal
• otfOverlapSwash
• otfProportionalMetrics
• otfRomanItalics
• otfSlashedZero
• otfStretchedAlternate
• otfStylisticAlternate
• otfStylisticSets
• otfSwash
• otfTitling
• overprintFill
• overprintStroke
• paragraphBorderBottomLeftCornerOption
• paragraphBorderBottomLeftCornerRadius
• paragraphBorderBottomLineWeight
• paragraphBorderBottomOffset
• paragraphBorderBottomOrigin
• paragraphBorderBottomRightCornerOption
• paragraphBorderBottomRightCornerRadius
• paragraphBorderColor
• paragraphBorderDisplayIfSplits
• paragraphBorderGapColor
• paragraphBorderGapOverprint
• paragraphBorderGapTint
• paragraphBorderLeftLineWeight
• paragraphBorderLeftOffset
• paragraphBorderOn
• paragraphBorderOverprint
• paragraphBorderRightLineWeight
• paragraphBorderRightOffset
• paragraphBorderStrokeEndCap
• paragraphBorderStrokeEndJoin
• paragraphBorderTint
• paragraphBorderTopLeftCornerOption
• paragraphBorderTopLeftCornerRadius
• paragraphBorderTopLineWeight
• paragraphBorderTopOffset
• paragraphBorderTopOrigin
• paragraphBorderTopRightCornerOption
• paragraphBorderTopRightCornerRadius
• paragraphBorderType
• paragraphBorderWidth
• paragraphDirection
• paragraphGyoudori
• paragraphJustification
• paragraphKashidaWidth
• paragraphShadingBottomLeftCornerOption
• paragraphShadingBottomLeftCornerRadius
• paragraphShadingBottomOffset
• paragraphShadingBottomOrigin
• paragraphShadingBottomRightCornerOption
• paragraphShadingBottomRightCornerRadius
• paragraphShadingClipToFrame
• paragraphShadingColor
• paragraphShadingLeftOffset
• paragraphShadingOn
• paragraphShadingOverprint
• paragraphShadingRightOffset
• paragraphShadingSuppressPrinting
• paragraphShadingTint
• paragraphShadingTopLeftCornerOption
• paragraphShadingTopLeftCornerRadius
• paragraphShadingTopOffset
• paragraphShadingTopOrigin
• paragraphShadingTopRightCornerOption
• paragraphShadingTopRightCornerRadius
• paragraphShadingWidth
• pointSize
• position
• positionalForm
• preferences
• previewColor
• providerHyphenationStyle
• rensuuji
• rightIndent
• rotateSingleByteCharacters
• rubyAlignment
• rubyAutoAlign
• rubyAutoScaling
• rubyAutoTcyAutoScale
• rubyAutoTcyDigits
• rubyAutoTcyIncludeRoman
• rubyFill
• rubyFont
• rubyFontSize
• rubyFontStyle
• rubyOpenTypePro
• rubyOverhang
• rubyOverprintFill
• rubyOverprintStroke
• rubyParentOverhangAmount
• rubyParentScalingPercent
• rubyParentSpacing
• rubyPosition
• rubyStroke
• rubyStrokeTint
• rubyTint
• rubyType
• rubyWeight
• rubyXOffset
• rubyXScale
• rubyYOffset
• rubyYScale
• ruleAbove
• ruleAboveColor
• ruleAboveGapColor
• ruleAboveGapOverprint
• ruleAboveGapTint
• ruleAboveLeftIndent
• ruleAboveLineWeight
• ruleAboveOffset
• ruleAboveOverprint
• ruleAboveRightIndent
• ruleAboveTint
• ruleAboveType
• ruleAboveWidth
• ruleBelow
• ruleBelowColor
• ruleBelowGapColor
• ruleBelowGapOverprint
• ruleBelowGapTint
• ruleBelowLeftIndent
• ruleBelowLineWeight
• ruleBelowOffset
• ruleBelowOverprint
• ruleBelowRightIndent
• ruleBelowTint
• ruleBelowType
• ruleBelowWidth
• sameParaStyleSpacing
• scaleAffectsLineHeight
• shataiAdjustRotation
• shataiAdjustTsume
• shataiDegreeAngle
• shataiMagnification
• singleWordJustification
• skew
• spaceAfter
• spaceBefore
• spanColumnMinSpaceAfter
• spanColumnMinSpaceBefore
• spanColumnType
• spanSplitColumnCount
• splitColumnInsideGutter
• splitColumnOutsideGutter
• splitDocument
• startParagraph
• strikeThroughColor
• strikeThroughGapColor
• strikeThroughGapOverprint
• strikeThroughGapTint
• strikeThroughOffset
• strikeThroughOverprint
• strikeThroughTint
• strikeThroughType
• strikeThroughWeight
• strikeThru
• strokeAlignment
• strokeColor
• strokeTint
• strokeWeight
• styleExportTagMaps
• styleUniqueId
• tabList
• tabStops
• tatechuyoko
• tatechuyokoXOffset
• tatechuyokoYOffset
• tracking
• trailingAki
• treatIdeographicSpaceAsSpace
• tsume
• underline
• underlineColor
• underlineGapColor
• underlineGapOverprint
• underlineGapTint
• underlineOffset
• underlineOverprint
• underlineTint
• underlineType
• underlineWeight
• verticalScale
• warichu
• warichuAlignment
• warichuCharsAfterBreak
• warichuCharsBeforeBreak
• warichuLineSpacing
• warichuLines
• warichuSize
• xOffsetDiacritic
• yOffsetDiacritic
*/
Hope that gives you something to work with.
- Mark
Copy link to clipboard
Copied
It's Great help mark, thanks in advance.
Just 1 question; in this code:
myParagraphStyle = doc.paragraphStyles.itemByName('My Paragraph Style');
Should I change ('My Paragraph Style') to my paragraph style in the doc?
Is there any code can search in the paragraph styles in the file instead of insert paragraph style names.?
I hope that my question not bothering you
Copy link to clipboard
Copied
1 one question, how and where you write this code to get the right properties ?
instead of NotePad or any other text editor.
Copy link to clipboard
Copied
If you are planning to do more scripting, I would highly recommend using the free Visual Studio Code. It is an excellent IDE in general. You will need the ExtendScript Debugger which you can download here after you've installed VSCode. It does take a bit of reading and searching to get up and running this way, but it is worth it if you are doing more than just the occasional script file edits without the need for debugging. - Mark
Copy link to clipboard
Copied
Thanks Mark for you reply that make me everytime learn more and more 😄
i'm really appreciate your help.
Amr.
Copy link to clipboard
Copied
Should I change ('My Paragraph Style') to my paragraph style in the doc?
Yes.
Is there any code can search in the paragraph styles in the file instead of insert paragraph style names.?
Sure it can be done in a script. Can you describe what you need?
For example, if you want to set certain properties of every paragraph style in the document, you can do this:
/**
* Set properties of ALL paragraph styles in acrtive document.
* @author m1b
* @discussion https://community.adobe.com/t5/indesign-discussions/search-in-paragraph-styles/m-p/13855341
*/
function main() {
var doc = app.activeDocument,
myParagraphStyles = doc.paragraphStyleGroups.everyItem().paragraphStyles.everyItem();
// example of changing some properties
myParagraphStyles.properties = {
composer: 'Adobe Paragraph Composer',
characterDirection: CharacterDirectionOptions.RIGHT_TO_LEFT_DIRECTION,
hyphenation: false,
pointSize: 11,
};
}
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Adjust Paragraph Styles');
- Mark
Copy link to clipboard
Copied
Hello @m1b
I'm really thank you very much on your great help.
actually i spent a lot of time to do my required script to change the specific attributes in styles.
but in simple, i do this by VSCode,
but, i want more thing to be in the code.
Could I ask from you direct contacting via Discord or skype or any other way? so we can easly discussing on what i want to preform !
will be waiting your reply.
Thanks.
Amr.
Copy link to clipboard
Copied
Hello @m1b
can i make the search for the attributes for all paragraph style in the file ?! instead of the one by one ?
Copy link to clipboard
Copied
InDesign's find-replace is for text only. To change attributes in paragraph styles, you can do that manually in the Paragraph Style Options window, or you can script it.
If the paragraph styles were set up using the based-on feature, maybe you need to change only one style (if you're very lucky) and the change will propagate to all styles. Or maybe the styles are based on two or three styles, in which case it's still easier simply to make the change manually. Only when you'd have to change a lot of styles would it be useful to do a script.
Copy link to clipboard
Copied
Thanks peter for your reply,
InDesign Find-replace didn't work with me as there are a lot of them need to change.
also the paragraph styles not build on 1 as main, they seperated every one in the file, that's why i asked for the way or sscripting it.
Copy link to clipboard
Copied
I assume you could quickly update them by doing something like this:
var page = app.documents.item(0);
var param = page.paragraphStyles.everyItem().appliedFont = "nimbus sans"
If there are unique changes for each style that need to be made you'd just loop through the collection instead of applying to all of them at once.
Copy link to clipboard
Copied
Thanks fill, but i figuer our that this code is for change the fonts used in the paragraphs you mean ?!
if so, what should i change in the code to change the direction, alignment, font size, ect. ?
it will be good to send me an example and i could continue.
Copy link to clipboard
Copied
In the code above you can replace .appliedFont with required property from the 2nd reply from @m1b with correct parameter.
More info about all the properties you can find here:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#about.html
Copy link to clipboard
Copied
Thanks Robert, i twill try and get back with results.
Copy link to clipboard
Copied
If you'd like a convenient, off-the-shelf solution, check out my (not free) Search in Styles - Id-Extras.com
You set up the regular InDesign find/change dialog as usual, as though you wanted to make changes in regular text. But then, instead of clicking on Find, you run the script Search in Styles.
It then performs your find/change on some or all of the paragraph or character styles in the document, not on the live text, but on the styles.
However, bear in mind that this will only let you search for properties in the styles that you can search for in text itself.
So, of those you've mentioned above, you'll be fine to search for font size, paragraph direction, and even paragraph composer. But you mentioned hyphenation. Hyphenation is not something that you can search for with InDesign's regular find/change, unfortunately. And therefore you would not be able to search for it with the Search in Styles script either.
Copy link to clipboard
Copied
Hello Taw.
thanks for offer, i will give it a try, as i saw the price will be so much high for me as i'm personal not a company.
antway, thanks for your geat help.