添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
慈祥的数据线  ·  Chapter1. ...·  1 月前    · 
聪明的海龟  ·  Django学习篇04-Django ...·  5 月前    · 
冷静的酱牛肉  ·  Activity.OnDestroy 方法 ...·  9 月前    · 
星星上的企鹅  ·  .hpp与.h区别 - 掘金·  1 年前    · 

I'm trying a to automatically add the date to an items name in the render queue.

I have the following.

var x = app.project.renderQueue.item(1).outputModule(1);

alert (x.file.name);

This returns the name of the file that will be output but I'm unable to change this value. The scripting guide says this attribute is read/write but I can't figure out how to alter it.

Thanks.

Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Have you tried setting the .file property of the RenderItem to a new File() object that uses the filename you want?

var defaultName = renderItem.outputModule(1).file.name,

newFilename = defaultName + “_” + Date(); //probably need some get the date back in a more elegant way

renderItem.outputModule(1).file = File(newFileName);

—Arie

Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Thanks gents. Big help. Actually David you solved my major problem on this issue with the provideo coalition tutorials.

Here is the script I ultimately wound up writing. Le me know if you think I should have done something different.

var d = new Date ();
var nnum = d.getDate();
var mnum = d.getMonth() + 1;
var ynum = d.getFullYear();
var n = nnum.toString();
var m = mnum.toString();
var y = ynum.toString();
if (mnum <= 9) {
m = "0" + m
}
if (nnum <= 9) {
n = "0" + n
}
// y = y.slice(2);
//change your date format here
var writeDate = m+n+y;


var proj = app.project;
var myRQ = proj.renderQueue;
var numOM, oldName;
var path = "";
var fileExt =""

for(var i = 1; i <= myRQ.numItems; i++) {
if(app.project.renderQueue.item(i).status == 2615){
oldName = myRQ.item(i).outputModule(1).file.name;
fileExt = oldName.slice(oldName.length - 4)
oldName = oldName.substring(0, oldName.length - 4);
newName = oldName + "_" + writeDate;
path = myRQ.item(i).outputModule(1).file.path;
myRQ.item(i).outputModule(1).file = new File(path + "/" + newName + fileExt);
numOM = myRQ.item(i).outputModules.length;
if(numOM > 1){
for(var o = 2; o <= numOM; o++){
oldName = myRQ.item(i).outputModule(o).file.name;
fileExt = oldName.slice(oldName.length - 4)
oldName = oldName.substring(0, oldName.length - 4);
newName = oldName + "_" + writeDate;
path = myRQ.item(i).outputModule(o).file.path;
myRQ.item(i).outputModule(o).file = new File(path + "/" + newName + fileExt);
}
}
}
}

Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more