Premiere Pro & ExtendScript


notice following section of code:

 

for (i = 0; <= app.project.rootitem.children.numitems; i++)

    {

        if (app.project.rootitem.children[i].getmediapath().indexof('(prev)') > -1)

    {

        var bcvpath = "d:\4) videos\dummy(prev).psd"

        app.project.rootitem.children[i].changemediapath(bcvpath);

    }

    }

 

what intend search through of imported files in current project and, once file containing text "(prev)" found, replace file 1 @ specified, absolute, hard-coded directory.  however, script has 2 problems:

 

  1. upon running code extendscript, receive error in premiere pro.  i have 1 file containing text "(prev)" imported project.
    7f4cbfddb9614afbbf1d7831ac970e3e.png
  2. which followed error appears within extendscript (after clicking ok on dialogue box):
    8dc0d140d4b547bbb540bbe9e7ad7b33.png

i not understand how create absolute file path reference use .changemediapath()

i cannot figure out why extendscript gives me undefined not object error after has "successfully" executed entire script.  can please offer insight need fix since there little documentation premiere pro , extendscript?

you need checks. getmediapath() returns undefined when current item folder, sequence or title. try this:

 

for (i = 0; <= app.project.rootitem.children.numitems; i++) {

     var child = app.project.rootitem.children[i];

     if (!child) continue;

     var mediapath = child.getmediapath();

     if (mediapath && mediapath.length > 0 && mediapath.indexof('(prev)') > -1) {

          // something

     }

}

 

regarding line:

var bcvpath = "d:\4) videos\dummy(prev).psd"

 

a backslash "\" in string used escape subsequent character. unfortunately, on windows it´s used file paths. need tell extendscript want include backslash in string , not use escaping -> have escape backslash.

 

try this:

var bcvpath = "d:\\4) videos\\dummy(prev).psd"



More discussions in Premiere Pro SDK


adobe

Comments

Popular posts from this blog

Illustrator CS6 Ocurrío un error E/S en el archivo.

Why is os_ViewContainer running?

Animate - problem with duplicating scripts after loop