Skip to main content
dbDavideBoscolo
Legend
April 4, 2024
Open for Voting

Scripting - check if character is selected - CharacterRange object attribute

  • April 4, 2024
  • 8 replies
  • 1418 views

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. 

 

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.

8 replies

_nicdean
Community Expert
Community Expert
August 30, 2024

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.

Adobe Employee
August 29, 2024

@dbDavideBoscolo I sent you a private message.

 

Douglas Waterfall

After Effects Engineering

dbDavideBoscolo
Legend
August 29, 2024

Hello Douglas, do you have any update on this?

dbDavideBoscolo
Legend
June 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.

Adobe Employee
June 25, 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

dbDavideBoscolo
Legend
June 1, 2024

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

dbDavideBoscolo
Legend
April 8, 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!

Adobe Employee
April 6, 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