Expressions/Scripts/Presets

Moderator: byronnash

 
JabedBhuiyan
Topic Author
Posts: 1
Joined: Mon Aug 25, 2014 9:10 am

Rename file when import

Mon Aug 25, 2014 9:55 am

Here is script which import a mp4 file from my "d" drive.
{
var imgDir = ("d:");
var newAmt = 1;
if (!app.project) { app.newProject(); }
var myItemCollection = app.project.items;
var myComp = app.project.activeItem;
var myProperty;
function processFolder(theFolder)
{

for (var j=4; j < 5; j++)
{
var importOpts = new ImportOptions( new File(theFolder + "aff"+".mp"+j) );
var importImg = app.project.importFile (importOpts);
var myImg = myComp.layers.add(importImg, );
}
}
processFolder(imgDir);
}

it import a "aff.mp4" file from my directory. But i want to rename the "aff.mp4" file when it import. is it possible? Please help me...
 
Paul Tuersley
Posts: 704
Joined: Sat Jun 05, 2004 7:59 am
Location: London, UK

Re: Rename file when import

Wed Aug 27, 2014 3:44 am

You mean you want to rename it in the project? The item object, which is the base object for all items in the project panel, has a name attribute which is read/write, so that should just be:
importImg.name = "myName";

Who is online

Users browsing this forum: No registered users and 3 guests