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

Script request: Increase point size by 1 point

Participant ,
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

425

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

People's Champ , 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.

Votes

Translate

Translate
People's Champ ,
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.

Votes

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

Copy link to clipboard

Copied

Thanks TaW! Works perfectly 🙂 

Votes

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
Community Expert ,
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"

 

Votes

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