Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Insert tab after the number(up to 2 digits) Script

Explorer ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

I would like to create a script that will simply adds tabs after the (number and the period). I was trying the ChainGrep, but cant find a way to execute it. I tried using find and replace as one of the ChainGrep: 

FIND: \d. REPLACE: \d.\t but it simply replace the number as "\d.\t" converted to chracters. Is there any way to execute this? Thanks in advance. 

Screen Shot 2021-04-27 at 9.01.03 AM.png

TOPICS
How to, Scripting, SDK, Type

Views

632

Likes

Translate

Translate

Report

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

Adobe Community Professional , Apr 27, 2021 Apr 27, 2021
Did you try: FIND: (\d+\.)\s CHANGE: $0\t Better yet, why not strip the manual numbering out in favor of a numbered Paragraph Style?

Likes

Translate

Translate
Adobe Community Professional ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

Did you try:

FIND: (\d+\.)\s

CHANGE: $0\t

 

Better yet, why not strip the manual numbering out in favor of a numbered Paragraph Style?

 

Mike Witherell

Likes

Translate

Translate

Report

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 ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

This is perfect Mike! thanks! But how will I remove the single space before the tab? Thank you so much!Screen Shot 2021-04-27 at 9.34.36 AM.png

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

F: \s\t

C: \t

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

I thought I had accounted for the space...

Mike Witherell

Likes

Translate

Translate

Report

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 ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

Thank you all, my next question is how can I find and apply character style when a TITLE consists of number of words. I was able to execute it on Titles that has only one word. (see attached image). I failed to apply the Character style which is BOLD and ALL CAPS to "Mise En Garde : " Thanks in advance

 

im using

app.findChangeGrepOptions.properties = ({includeFootnotes:true, kanaSensitive:true, widthSensitive:true});
app.findGrepPreferences.properties = ({findWhat:"\\r\\w+\\:|\\r\\w+\\s\\:"});
app.changeGrepPreferences.properties = ({fontStyle:"Bold Condensed", capitalization:1634493296});
changeObject.changeGrep();
Screen Shot 2021-04-27 at 2.38.41 PM.png

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

Of course, you can replace the space with a tab.

 

But:

Create a new paragraph style with a numbering list.

Then I would remove digits, dot and space with Grep and at the same time assign the new created paragraph style with the numbering list. This will make handling much easier in the future.

F:  ^\d+\.\h([\l\u])

C:  $1

digit_change_in_Numbering.png

  

Likes

Translate

Translate

Report

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 ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

Thank you all, my next question is how can I find and apply character style when a TITLE consists of number of words. I was able to execute it on Titles that has only one word. (see attached image). I failed to apply the Character style which is BOLD and ALL CAPS to "Mise En Garde : " Thanks in advance

 

im using

app.findChangeGrepOptions.properties = ({includeFootnotes:true, kanaSensitive:true, widthSensitive:true});
app.findGrepPreferences.properties = ({findWhat:"\\r\\w+\\:|\\r\\w+\\s\\:"});
app.changeGrepPreferences.properties = ({fontStyle:"Bold Condensed", capitalization:1634493296});
changeObject.changeGrep();

Screen Shot 2021-04-27 at 2.38.41 PM.png

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

Use nested styles in a new paragraph format for all paragraphs with ":"

nested_Doppelpunkt.png

Likes

Translate

Translate

Report

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 ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

can i execute this without using character o paragraph style?

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

There is only one truth in InDesign: only work with styles! Never use formatting that differs from the paragraph format.

Likes

Translate

Translate

Report

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 ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

I got your point, unfortunately we are working with files that is too complex to have paragraph/character styles. I just want to re-apply BOLD and ALL CAPS to the first word, just like I did on the 2nd and 3rd entry, unfortunately i dont know what grep to use to FIND all words before the COLON symbol.

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

 

 

I got your point, unfortunately we are working with files that is too complex to have paragraph/character styles …


By @Joseph Christian5C7F

 

Sorry. But I've never heard anything so strange.

 

But it doesn't matter. Try this grep:

^[^:]+:

But be sure, that there is no other colon in your text.

Likes

Translate

Translate

Report

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
Advisor ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

^.+?:

 

(^/)  The Jedi

Likes

Translate

Translate

Report

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 ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

yea its weird, Im also used on using paragraph styles but this particular artworks does not require those process.

Thank you pixxelschubser and FRidNGE it actually worked. unfortunately i have some colon symbols across the paragraphs, but atleast now I know what GREP to use. Thank you so much

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 27, 2021 Apr 27, 2021

Copy link to clipboard

Copied

A second or third colon in your paragraph does not matter - but "a single" colon in the paragraph (standalone).

Likes

Translate

Translate

Report

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 ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

yes thats the problem I have right now, but anyway thank you so much!. Can I also ask how can I set the value of the tab char that I inserted after the number? I need to set it at 0.125 in. thanks is advance

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

Correctly, that would be done as an attribute in the Paragraph Style (Tabs).

Mike Witherell

Likes

Translate

Translate

Report

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 ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

Yes Mike, thats what I have right now. But, is there a way to have it on the script?

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

(Apologies if I don't completely understand you)

Find/Change can look for text and keep it the same while also applying a Paragraph and/or Character style. If your text is already correctly styled and also shows a + plus sign after the style in the styles panel, then you are suffering from overrides of extra attributes. Click the little button at the bottom of the paragraphs style panel to remove any overrides. This will return your text to the correct tab positioning you set in the paragraph style.

Mike Witherell

Likes

Translate

Translate

Report

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 ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

Im creating a script using ChainGrep, so technically I want to compile every GREP i need to build a script that will automatically format everything without using any paragraph/character styles. Everything is working fine now, but I want to add another feature were it can set the value of the tab char to 0.125 in.

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

ChainGREP does the sequence of separate Find/Changes.

One of the Find/Changes applies Formatting via a Paragraph Style

The Paragraph Style supplies the Tab distance value.

It is all a trickle-down.

Mike Witherell

Likes

Translate

Translate

Report

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 ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

Screen Shot 2021-04-28 at 1.32.38 PM.png

Likes

Translate

Translate

Report

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 ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

Screen Shot 2021-04-28 at 1.39.56 PM.png

Likes

Translate

Translate

Report

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 ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

Sorry, I need to screencapture my replies. I got some notif saying that Im post flooding.

Likes

Translate

Translate

Report

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
    • 1
    • 2