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

How find strokes with different thicknesses

Explorer ,
Jun 05, 2019 Jun 05, 2019

Is there a way to find and replace all the strokes comprised between different thicknesses, for example between 0.01 pt and 0.09 pt with strokes of 0.1 pt thickness?

2.0K
Translate
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

Community Expert , Jun 05, 2019 Jun 05, 2019

There you go. Save as "fixHairlines.jsx" in your own personal Scripts folder (if this sounds daunting, read https://indesignsecrets.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-post.php ), double-click to run. It presents a simple dialog in which you can fill in the minimum and maximum weights to change (both inclusive) and the weight to change to.

Did only a very small test but I foresee no problems. InDesign pops up an automatic message if you try to find objects on

...
Translate
Community Expert ,
Jun 05, 2019 Jun 05, 2019

Not really; but isn't it easy enough to select all of your objects and then apply your new stroke weight?

Translate
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
Community Expert ,
Jun 05, 2019 Jun 05, 2019

For others reading this thread who just want to update one variation—and not a range of variations—you can use an Object Find/Change.

Screen Shot 2019-06-05 at 9.54.34 AM.png

~Barb

Translate
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
Explorer ,
Jun 05, 2019 Jun 05, 2019

Let me explain better, I have a catalog of 64 pages, some strokes have been scaled in percentage and have a thickness that is 0.08 pt, but this thickness is not real because it is rounded by indesign (the actual measurement would be 0.07953 pt), so if I look for all tracks with a thickness of 0.08 pt I can't find anything.

Translate
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
Community Expert ,
Jun 05, 2019 Jun 05, 2019

Leave the value blank in Search, and set 0.08 in Replace.

And if you need to change again, you now can Find value 0.08 and change that. But, big But, it will change AL lines to 0.08 when left blank, I don't know if that presents a problem of course f you need other line values NOT to change...

Anyway, a 'find 00.8 or any maller value' (a conditional search) is not possible...

Translate
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
Explorer ,
Jun 05, 2019 Jun 05, 2019

Not good because in this way because so all lines become 0.08 pt, while I want for example that those of 0.2 pt are not changed and those of 0.5 pt are not changed, but replace only those included between 0.01 and 0.09 pt with 0.1 pt

Translate
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
Community Expert ,
Jun 05, 2019 Jun 05, 2019

Hi bebez71:

replace only those included between 0.01 and 0.09 pt

I agree with [Jongware]'s initial assessment. There is no easy way to do this where you are trying to find a range of weights. But on a public forum like this one, someone will search for how to globally find all the lines of a specific weight, and that's why I added to his answer. 

~Barb

Translate
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
Mentor ,
Jun 05, 2019 Jun 05, 2019

InDesign has a lot of exciting features. Well, not this one. FWIW, Acrobat has something close (Tools > Print Production > Fix Hairlines):

fixhair.gif

Translate
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
Community Expert ,
Jun 05, 2019 Jun 05, 2019

bebez71  wrote

.. I have a catalog of 64 pages, some strokes have been scaled in percentage and have a thickness that is 0.08 pt, but this thickness is not real because it is rounded by indesign (the actual measurement would be 0.07953 pt), so if I look for all tracks with a thickness of 0.08 pt I can't find anything.

Okay – it may be possible to write a script for this. It will be necessarily *slow* because it might have to check every individual object ... Can you show a screenshot of your Find/Change Object Dialog (the one which BarbBinder​ shows) which will find all of the strokes, regardless of their width? I would try to find, for example, "only Black ones" if they are all black, or "only Solid Stroke ones" if the colors are different. It takes much more scripting if all of these strokes can be in all possible stroke styles, all possible colors, and/or as lines, on rectangles and ovals, as Paragraph Rule Above or Below, as Table Strokes (where only some sides on some cells need checking), and/or as Underline. As you can see, there are a lot of combinations – and every object (and paragraph, underlined, text, and four sides per cell for every cell in every table) needs checking for your widths.

If you are confident you can find all objects that need checking, then the script will run much faster and more reliable.

Translate
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
Community Expert ,
Jun 05, 2019 Jun 05, 2019

This won't help on this catalog, but for the next one, if you use object styles for all of your lines, then you can do a global search to replace the object style with itself. This will re-apply the style, returning the line weights to their original values.

Translate
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
Explorer ,
Jun 05, 2019 Jun 05, 2019

Thanks wintermI did not know (or did not remember) this function in Acrobat.

And thanks to [Jongware], I found this workaround by reading his answer.

The strokes that are ok, are 100% black and are 1, 0.2 and 0.5 pt thick.

The wrong ones are thinner than 0.2 pt.

So I created a spot color and with the find/change, I applied it to that strokes (1, 0.2 and 0,5 pt), then I searched for all the strokes that were left black and replaced them with a thickness of 0.2 pt, then I deleted the color spot color, replacing it with black.

It worked!

Translate
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
Community Expert ,
Jun 05, 2019 Jun 05, 2019

That is some excellent out-of-the-box thinking! It's how I'd also look for text which may have a different formatting – mark all 'correct' ones with a color and then look for what's left without the marker.

Just for fun, I'm going to go ahead and try if my idea works as well – it still may be handy to have around. Will report back if successful.

Translate
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
Mentor ,
Jun 05, 2019 Jun 05, 2019

[Jongware]  wrote

I'm going to go ahead […] Will report back if successful.

Sounds very promising. I'm holding my breath already . We really need some functionality of this kind in ID.

Translate
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
Community Expert ,
Jun 05, 2019 Jun 05, 2019

There you go. Save as "fixHairlines.jsx" in your own personal Scripts folder (if this sounds daunting, read https://indesignsecrets.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-po... ), double-click to run. It presents a simple dialog in which you can fill in the minimum and maximum weights to change (both inclusive) and the weight to change to.

Did only a very small test but I foresee no problems. InDesign pops up an automatic message if you try to find objects on locked layers or in locked stories, and to prevent that, I disable these two options. The other settings – type, master pages, hidden layers – should (theoretically) remain as last set.

It does not seem to work with finding 0 point line weights, but I guess that should be a rarity – this script is to change existing line weights, not to add one to objects that don't have one.

It's undo-able in a single step.

//Find and change line weights between certain values

// A Jongware Script 05-Jun-2019

app.doScript(fixHairlines, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Fix hairlines");

function fixHairlines()

{

    var thicknessDialog = app.dialogs.add({name:"Fix hairlines", canCancel:true});

    with (thicknessDialog)

    {

        with(dialogColumns.add())

        {

            with(dialogRows.add())

            {

                staticTexts.add({staticLabel:"Minimum weight"});

                minweight = measurementEditboxes.add({editUnits:MeasurementUnits.POINTS, editValue:0.01,largeNudge:0.1,smallNudge:0.01,minimumValue:0,maximumValue:999});

            }

            with(dialogRows.add())

            {

                staticTexts.add({staticLabel:"Maximum weight"});

                maxweight = measurementEditboxes.add({editUnits:MeasurementUnits.POINTS, editValue:1.0,largeNudge:0.1,smallNudge:0.01,minimumValue:0,maximumValue:999});

            }

            with(dialogRows.add())

            {

                staticTexts.add({staticLabel:"Change to"});

                setweight = measurementEditboxes.add({editUnits:MeasurementUnits.POINTS, editValue:1.0,largeNudge:0.1,smallNudge:0.01,minimumValue:0,maximumValue:999});

            }

        }

    }

    if (thicknessDialog.show() == true)

    {

        app.findObjectPreferences = null;

        app.findChangeObjectOptions.includeLockedLayersForFind = false;

        app.findChangeObjectOptions.includeLockedStoriesForFind = false;

        list = app.documents[0].findObject();

        for (i=0; i<list.length; i++)

        {

            if (list.strokeWeight >= minweight.editValue &&

                list.strokeWeight <= maxweight.editValue)

                list.strokeWeight = setweight.editValue;

        }

    }

}

Translate
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
Community Expert ,
Jun 05, 2019 Jun 05, 2019

Very nice script!

It makes no difference however between a real line and line around a frame...

Translate
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
Community Expert ,
Jun 05, 2019 Jun 05, 2019

What is the difference? You mean text frames? If that's the case, then you probably could set the Find Object options to limit to one kind. But yeah, sure, another option would be to add a few checkboxes here, something like "Lines, Graphic Frames, Text Frames". And then check the object type before changing.

Will look later into that – it is horribly late at nite over here.

Translate
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
New Here ,
Sep 22, 2025 Sep 22, 2025

@Jongware I know this is an old post, but this script would be helpful to me. Unfortunately, I'm a script dummy. If I wanted to find any stroke smaller than .5 and change it to .5, what would the script look like? I'm not understanding how to place the values. Getting the script into InDesign isn't a problem. Thanks so much!

Translate
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
Valorous Hero ,
Sep 23, 2025 Sep 23, 2025

Unfortunately,  Jongware is not with us anymore: he passed to a better world.

I looked into his code and, I think, found a mistake: list.strokeWeight should be list[i].strokeWeight.
Here on my site, I posted an adjusted version.
The screenshot below illustrates how to use it (nothing complex):

Fix hairlines.jpg

Translate
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
New Here ,
Sep 25, 2025 Sep 25, 2025
LATEST

@Kasyan Servetsky Thank you so much for your reply - I really appreciate it! weezie_0000

Translate
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
Explorer ,
Jun 06, 2019 Jun 06, 2019

Great script [Jongware], compliments it works perfectly

Translate
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
New Here ,
Sep 23, 2025 Sep 23, 2025

No, InDesign does not support finding and replacing stroke weights within a range using built-in tools. You need a script to do that.

Translate
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