Skip to main content
dbDavideBoscolo
Legend
Apr 4, 2024 7:36 AM UTC
Open for Voting

Scripting - check if character is selected - CharacterRange object attribute

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
Aug 30, 2024 5:51 AM UTC

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
Adobe Employee
Aug 29, 2024 3:38 PM UTC

@dbDavideBoscolo I sent you a private message.

 

Douglas Waterfall

After Effects Engineering

Translate
dbDavideBoscolo
Legend
Aug 29, 2024 1:41 AM UTC

Hello Douglas, do you have any update on this?

Translate
dbDavideBoscolo
Legend
Jun 28, 2024 8:31 AM UTC

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
Adobe Employee
Jun 25, 2024 3:58 AM UTC

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
dbDavideBoscolo
Legend
Jun 1, 2024 12:33 AM UTC

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

Translate
dbDavideBoscolo
Legend
Apr 8, 2024 1:20 AM UTC

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
Adobe Employee
Apr 6, 2024 7:37 AM UTC

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