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:
- upon running code extendscript, receive error in premiere pro. i have 1 file containing text "(prev)" imported project.
- which followed error appears within extendscript (after clicking ok on dialogue box):
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
Post a Comment