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

ExtendScript edit title object

Community Beginner ,
Nov 17, 2015 Nov 17, 2015

Hi

I want to edit a title object using a script. The problem is I don't know which class represents a title object. What I want to do is change the title and also position it where I choose. Please, help with reference!

Thanks

TOPICS
SDK
2.7K
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

correct answers 1 Correct answer

Adobe Employee , Nov 18, 2015 Nov 18, 2015

You'll need to export the title (from the project, to a .prtl file) first.

https://helpx.adobe.com/premiere-pro/using/creating-editing-titles.html

Translate
Adobe Employee ,
Nov 17, 2015 Nov 17, 2015

There is no API around changing elements of a title.

However, you may find that the .prtl file itself is .xml, formatted in a pretty human-readable fashion...

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 Beginner ,
Nov 18, 2015 Nov 18, 2015

Hi, thanks for your reply Can you please clarify where exactly can I find and edit the .prtl file?

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
Adobe Employee ,
Nov 18, 2015 Nov 18, 2015

You'll need to export the title (from the project, to a .prtl file) first.

https://helpx.adobe.com/premiere-pro/using/creating-editing-titles.html

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 Beginner ,
Nov 18, 2015 Nov 18, 2015

In our case we reuse the same project in many instances, just as we import it we change the title. Would that therefore be impossible to be done with Extendscript?

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
Adobe Employee ,
Nov 18, 2015 Nov 18, 2015

It's not impossible, IF...

You change the .prtl files on disk, THEN import them into your template project.

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 Beginner ,
Nov 18, 2015 Nov 18, 2015

Hi, thanks a lot! Should I use the File class and manually replace the whole xml or I could use some XML DOM reader? Sorry, I'm not too familiar with what API's the ExtendScript has access to.

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
Adobe Employee ,
Nov 18, 2015 Nov 18, 2015

There is no ExtendScritp API provided, for parsing XML. Yes, you could use ExtendScript's File class to manipulate XML.

Take a look inside an actual .prtl file; I think you'll be able to figure out which strings need replacing.

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 Beginner ,
Nov 24, 2015 Nov 24, 2015

Hi, so I've done this:

.......

     var file = new File("E:\\sub_test\\" + labels_max + ".prtl");

   

    file.open('r', undefined, undefined);

     

     var content = file.read();

    

     file.close();

    

    

     var name = prompt("enter 1", '');

     var sub = prompt("enter 2", '');

 

     content = content.replace(/<TRString>([a-zA-Zа-яА-Я]*)<\/TRString>/, '<TRString>' + name + '</TRString>');

     content = content.replace(/<\/TRString>(.*)<TRString>([a-zA-Zа-яА-Я]*)<\/TRString>/,  '</TRString>$1<TRString>' + sub + '</TRString>');

    

     //alert(content);

    

     file = new File("E:\\sub_test\\" + labels_max + ".prtl");

    

     file.open('w');

    

     file.write(content);

    

     file.close();

..........

It works okay but then that Title object is messed. The .prtl file has 40 KB size before this execution, and 20 KB after! The contents inside look the same, except for 2 symbols in the beginning of the original prtl which seem to be just 2 bytes long... What am I missing?

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

I can't help you edit the .xml; I think you may need to serialize the text before you write it.

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 Beginner ,
Nov 26, 2015 Nov 26, 2015

Well I could read and write only that part of the file where I need to edit and that managed to keep the proper size. Anyway, Adobe Premiere carasheswhenever I import the .prtl file. I even tried just manually editting these <TRString> tags with a text editor and importing failed again, Premiere crashes.

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
Adobe Employee ,
Nov 26, 2015 Nov 26, 2015

If that's so, then however you're editing the .prtl is breaking it. Line endings? Did you serialize your modified output, before saving?

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 Beginner ,
Nov 27, 2015 Nov 27, 2015

Actually I found the problem. After the TRString tag there is a CharacterAttributes tag where the RunCount attribute specifies the string length + 1. Having changed the TRString one should also change this attribute and now Premiere doesn't break. I will now proceed to finish my script. Thanks!

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 Beginner ,
Nov 27, 2015 Nov 27, 2015

Well, back here ... Having exported and editted the .prtl file, how can I import it now? Looking at this thread Is it possible to add a clip to a sequence using ExtendScript? I'm thinking that it is not yet supported ...

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
Adobe Employee ,
Nov 27, 2015 Nov 27, 2015

You can import it into the project using importFiles(), or replace an existing .prtl with changeMediaPath().

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 Beginner ,
Dec 01, 2015 Dec 01, 2015

I can import it, but I cannot change the media path - itemToEdit.canChangeMediaPath() returns false. How can I put it into the sequence?

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
Adobe Employee ,
Dec 03, 2015 Dec 03, 2015

Strange; let's pursue further, off-forum...

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
Adobe Employee ,
Feb 25, 2016 Feb 25, 2016
LATEST

Turns out, I was wrong: when a .prtl is imported, it creates a new Titler instance...which has no path.

So, you can change what's IN the .prtl, then re-import it, but you can't change the title once it's instantiated.

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