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

Access UPPERCASE setting by script in Illustrator

Explorer ,
May 19, 2024 May 19, 2024

Copy link to clipboard

Copied

uppercaseuppercase

 

I need to read that option from TextFrame. Is there a way?
There's FontCapsOption in CharacterAttributes, but it seems it does different thing..

Thanks in advance.

TOPICS
Bug , Feature request , Scripting , SDK

Views

185

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

Participant , May 20, 2024 May 20, 2024

What you're looking for is the capitalization attribute.

 

 

alert(app.activeDocument.textFrames[0].textRange.characterAttributes.capitalization)
app.activeDocument.textFrames[0].textRange.characterAttributes.capitalization = FontCapsOption.ALLCAPS
alert(app.activeDocument.textFrames[0].textRange.characterAttributes.capitalization)

 

 

on a blank document, this sample code just targets the first text frame and changes the capitalization setting to all caps. All of the Font Cap options you mentioned ar

...

Votes

Translate

Translate
Adobe
Explorer ,
May 20, 2024 May 20, 2024

Copy link to clipboard

Copied

Thanks for your answer and sorry for being unclear, I have updated the description now - but I need it in Illustrator...
Unfortuantely, illustrator's CharacterAttributes does not seem to to have this key. 

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 20, 2024 May 20, 2024

Copy link to clipboard

Copied

@dolce5EC2 

Unfortunately, the last reply appears to be from an Ai bot. They've been flooding the forum lately with only marginally correct (but generally incorrect) answers.

 

Back to the topic:
What exactly do you want to find (capitalise letters or words or sentences or whole paragraphs? and what exactly do you want to do with the result?

 

Personally, I usually use REGEX (regular expressions) in Javascript for such cases. However, to set up a suitable rule for REGEX, you need to know exactly what you want to search for (and ideally also what you want to do with the result afterwards).

 

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
Explorer ,
May 20, 2024 May 20, 2024

Copy link to clipboard

Copied

thank you, and yes that would be an approach to detect these changes.
I had wrong impression these menu commands set a setting to capitalization.. when in fact they modify actual contents.

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 20, 2024 May 20, 2024

Copy link to clipboard

Copied

What you're looking for is the capitalization attribute.

 

 

alert(app.activeDocument.textFrames[0].textRange.characterAttributes.capitalization)
app.activeDocument.textFrames[0].textRange.characterAttributes.capitalization = FontCapsOption.ALLCAPS
alert(app.activeDocument.textFrames[0].textRange.characterAttributes.capitalization)

 

 

on a blank document, this sample code just targets the first text frame and changes the capitalization setting to all caps. All of the Font Cap options you mentioned are what are used here

FontCapsOption.ALLCAPS

All Caps

FontCapsOption.ALLSMALLCAPS

All Smallcaps

FontCapsOption.NORMALCAPS

Normal Caps

FontCapsOption.SMALLCAPS

Small Caps

EDIT:

Wanted to also add. The above is a display change to the text. The text may internally be set as "Lorem Ipsum" but changed to display setting as All Caps would display as "LOREM IPSUM" while maintaining the internal text as "Lorem Ipsum". To access the Change case functionality you can either do a heavier coding approach to change the text contents or use the executeMenuCommand to access those commands.

https://ten-artai.com/illustrator-ccver-22-menu-commands-list/

app.executeMenuCommand("UpperCase Change Case Item")
app.executeMenuCommand("LowerCase Change Case Item")
app.executeMenuCommand("Title Case Change Case Item")
app.executeMenuCommand("Sentence case Change Case Item")

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
Explorer ,
May 20, 2024 May 20, 2024

Copy link to clipboard

Copied

LATEST

thanks for a detailed answer, RobOctobus it cleared my confusion between menu command and that setting - I was clicking menu command and reading setting to no avail, never tried to set set the setting by code. ..meanwhile menu command was modifyng actual text

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