I'm developing an extension for Adobe Premiere Pro using CS Extension Builder to import files from internet. I achieved that using the following code
var app:App = Premiere.app;
var pjct:Project=app.project;
var astPath:String = "path to file";
if(pjct!=null)
{
var fileArray:Array=[];
fileArray.push(astPath);
pjct.importFiles(fileArray);
}
Now I have to rename the file before it is imported to Premiere. I don't want to use the file name as it is in the server. How can I do that?
var astFile:File = new File("path to file");
var newLocation:File = new File("path to new location");
if(!astFile.exists){
throw new Error("Uh... you do need a valid file for this...");
}
astFile.moveTo(newLocation,true);// this will overwrite the file if it already exists!
You can then grab newLocation.url or newLocation.nativePath (assuming that's waht you need...)
Harbs
Hi Harbs,
Thanks for the quick reply. but this is not what I'm looking for.
I want to rename the file imported in Adobe Premiere Pro. I don't want to rename the exact file.
Being more specific to the question, I want to know more about the argument of importFiles() [Project.importFiles(args:Object);]
I think importFiles takes an array of File objects (see: http://forums.adobe.com/message/4710331). I'm not entirely sure what you mean by "renaming the imported file but not the exact file" - do you mean you don't want to rename the file on disk, but change the name Premiere uses for the file? I'm not sure if that's possible. The scripting DOM for Premiere is quite limited, and I'm afraid that I'm not that familiar with it.
Hope that helps,
--Louis
North America
Europe, Middle East and Africa
Asia Pacific