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

Scripting - check if character is selected - CharacterRange object attribute

Engaged ,
Apr 04, 2024 Apr 04, 2024

Copy link to clipboard

Copied

I'd like to know whether a character is or isn't selected via scripting. 

This way you can run a script on that portion of text only, instead of the whole text. 

dbDavideBoscolo_0-1703581500950.png

 

Currently, you have to use the Command ID 3018 to apply an animator with a range selector, then read its start and end indexes. And this has to be done before starting any UndoGroup or the text would be deselected.

Instead of using the Command ID, I tried this (again before the UndoGroup)

var animator = layer.Text.Animators.addProperty("ADBE Text Animator");
animator.property("ADBE Text Selectors").addProperty("ADBE Text Selector");

but the second line deselects the text again. So, it's not even an option.

Having to use the Command ID and having to use it before the UndoGroup is a bit of a pain in the ass (not to mention that you also have to delete the animator).

It would be nice to at least being able to use the above code inside the UndoGroup.
Ideally it would be nice to have a CharacterRange object attribute to check if a character is or isn't selected.

Idea No status
TOPICS
Scripting

Views

158

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
2 Comments
Adobe Employee ,
Apr 06, 2024 Apr 06, 2024

Copy link to clipboard

Copied

I think I have seen that image before...

 

My current thought is to return a generic object with Layer, Start, End, if a text selection exists.

 

Is there a case to be made for setting a Text selection via Scripting?


I am on extended break at the moment, but will look into this in late April.

 

Douglas Waterfall 

After Effects Engineering

Votes

Translate

Translate

Report

Report
Engaged ,
Apr 07, 2024 Apr 07, 2024

Copy link to clipboard

Copied

LATEST

Hi Douglas,

Thank you for replying!


Yes, an object with Start and End would also do the job!


Regarding selecting a portion of text via scripting, it wouldn't be of any use for me. And I can't think about a scenario where this could be needed at the moment. 

Have a nice holiday and thank you again!

Votes

Translate

Translate

Report

Report