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

Scripting - check if character is selected - CharacterRange object attribute

Engaged ,
Apr 04, 2024 Apr 04, 2024

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
1.2K
Translate
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
8 Comments
Adobe Employee ,
Apr 06, 2024 Apr 06, 2024

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

Translate
Report
Engaged ,
Apr 07, 2024 Apr 07, 2024

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!

Translate
Report
Engaged ,
May 31, 2024 May 31, 2024

Have you had a chance to look into this Douglas? Any news? 

Translate
Report
Adobe Employee ,
Jun 24, 2024 Jun 24, 2024

Thought about it today, @dbDavideBoscoloWhere would you put the API?

Project seems like the most obvious choice (Project.activeItem is the parallel), Item (Item.selectedLayers is the parallel), me I am attracted to Application for some reason.

 

Douglas Waterfall

After Effects Engineering

Translate
Report
Engaged ,
Jun 28, 2024 Jun 28, 2024

Hi Douglas, I'm not sure which option is more convenient. I'm not confident enough to make the call. I initially thought it had to do with sourceText, but even if it's attached to Application, it would probably work.

Translate
Report
Engaged ,
Aug 28, 2024 Aug 28, 2024

Hello Douglas, do you have any update on this?

Translate
Report
Adobe Employee ,
Aug 29, 2024 Aug 29, 2024

@dbDavideBoscolo I sent you a private message.

 

Douglas Waterfall

After Effects Engineering

Translate
Report
Community Expert ,
Aug 29, 2024 Aug 29, 2024
LATEST

adding support to this idea. Pairs nicely with the per-character scripting updates.

 

I would personally use this to update Style Bandit, and I can think of several other type tools that would benefit.

Translate
Report