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

Script or expression for italicising html code

New Here ,
Sep 02, 2021 Sep 02, 2021

Preface - I don't know how to code or script at all, but I understand what it can do to an extent. 

I'm looking for a JavaScript or Extendscript (or expression?) for converting text which includes the text formatting code <i> </i> around it actually into italics on After Effects text layers. 

I have a script that imports SRT files and converts them into text layers but these text layers have the html code <i> around certain words which were originally italicised in another application. I need these words inside this code to be become italicised and the html code gone basically. 

I hope this makes sense as I've never wrote a code in my life but I know how to run a script in After Effects so hoping someone can work their magic for me!

TOPICS
Expressions , FAQ , How to , Import and export , Scripting
224
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
Community Expert ,
Sep 02, 2021 Sep 02, 2021

With expressions you can set the "Faux Italics" property of a text, but as far as I know, you can do that only for the entire text and not for individual words:

https://helpx.adobe.com/after-effects/using/expressions-text-properties.html

 

With scripts it is also not possible to set the style of individual words of a text. Hence, if you don't want to do it manually, the only solution will probably be to split the text into multiple layers, which is pretty complex.

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
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
New Here ,
Sep 03, 2021 Sep 03, 2021
LATEST

Thank you for your reply!

 

The SRT importer which I use splits the SRT file 'captions' into separate text layers so that it's not one text layer.

Do you mean that the italicised text would need to be split into it's own layer entirely without any other unformatted words in that layer for a script to potentially work at coverting the italic tags?

 

With me not knowing anything about scripting, I was wondering would there be a sort of

Fetch all words inside "<i>" and  "</i>" on all text layers

Set Faux Italics property of text
Delete <i> </i> tag

This is the sort of idea I had in my head but maybe it's not possible.


The reason I would like this is that I have many long SRT files which have <i> incorporated into them upon import and I have to manually change the formatting on them all and it would save me a lot of time everyday and prevent me missing any of them. Wishful thinking perhaps!

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
Enthusiast ,
Sep 03, 2021 Sep 03, 2021

I created a script that imports SRT subtitles and also supports <i>, <b> style tags.

https://aescripts.com/pt_importsubtitles/

 

As Mathias said, AE doesn't have scripting support for setting multiple styles on a single text layer, so I had to jump through a lot of hoops to get it working. Not something I'd suggest tackling yourself if you're a newcomer to scripting.

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