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.


Script request: Increase point size by 1 point

Explorer ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

I'm looking for a script that when i have texthighlighted, I can run it and it will increase the point size by just 1 point. 

 

I know there is a way of changing this in the settings (units and increments) with no open documents so it applies it for all future documents created, however i often have to work on old files in which case it would revert back to the default of increasing it by 2. Seems to be document specific. 

 

Any help with this would be greatly appreciated. Thanks! 

TOPICS
Scripting

Views

283

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 , May 04, 2021 May 04, 2021
Something like this should do the trick: var tsr = app.selection[0].textStyleRanges.everyItem().getElements(); while (tsr.length) tsr.pop().pointSize += 1; Ariel P.S. There's no error testing here. So make sure to select some text before running the script.

Likes

Translate

Translate
Adobe Community Professional ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Something like this should do the trick:

 

var tsr = app.selection[0].textStyleRanges.everyItem().getElements();
while (tsr.length) tsr.pop().pointSize += 1;

 

Ariel

P.S. There's no error testing here. So make sure to select some text before running 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
Explorer ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Thanks TaW! Works perfectly 🙂 

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 ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

LATEST

You can also script an existing document’s preference setting:

 

 

//sets the document’s Size/Leading unit
app.activeDocument.textPreferences.leadingKeyIncrement = "1pt"

 

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