I'm trying to automate the "Save Frame As...File" function through a script. I've gotten it to work by sending an item to the render queue, changing the duration of the render to be 1 frame, and using a jpg template for the output module.
The problem comes in when naming what the render will be called. I do not want the render to have the time code or frame number in it.
If I save a frame through the interface, then the render will get named "comp_name (0;00;03;09)"
Then, clicking on the templates in the "Output To:" field, I can choose "Comp Name", and my comp will render as "comp_name"
If I run my script, I can set the output to be set as "comp name". However, if I then choose "Comp Name" (or any other Output To: template), and get the additional "[####]" added to the name.
Is there any way to add an item to the render queue, and not have it default back to "[####]", besides going into each comp, and running "Save Frame As..."
Hopefully this makes sense, and thanks for any help.
save frame as... through a script
Moderator: Paul Tuersley
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
If you don't want the frame number, am I assuming that you are not exporting more than 1 frame? If so, why do you need a script?
I need to be able to select a few hundred comps, and save out a single frame from each one. However, I also may need to change the "Output To:" name, depending on the factors in the comp, (ex. just a color channel, just an alpha, embedded alpha, etc.). So it would be very helpful if I could change the name the comp renders to, without the numbers getting added at the end.
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
I see, here's some code from a script that I wrote to set the output modules, including the file name:
Let me know if you have any questions.
Code: Select all
var curItem = app.project.renderQueue.item(existingRQ+1+a);
curItem.outputModule(1).file = new File(newLocation + "/" + network + element + thisItem.name.replace(/ /gi,"_") + OMSetterData.strFolderSuffix + "/" + network + element + thisItem.name.replace(/ /gi,"_") + OMSetterData.strOM1HDSuffix);
Though much time has passed on this topic...
I am having the same issue. I am scripting the creation of qicktimes etc. and also want to generate a single jpg thumbnail. There seems to be a flag set somewhere (in CS4 at least) that differentiates between rendering a single frame and rendering a sequence that is 1 frame long.
Small section of the code I am using:
var outFile = new File(outputFolder+"/"+outputModule.fileName);
// outfile= c:\temp\[compName]-thumbnail.jpg
qItem.outputModule(idx+1).file = outFile;
// When it is added to the module it converts [compName] to the comp name as it should
// However it ends up looking like this: (lets say the comp is named 'clip')
// c:\temp\clip-thumbnail.jpg_[#####].jpg
// If I trim it off the end and it looks ok in the queue
var messedUpName=qItem.outputModule(idx+1).file.name;
qItem.outputModule(idx+1).file=new File(outputFolder+"/"+messedUpName.replace(/_%5B#####%5D\.[^\._-]+$/i,''));
// Set it to a single frame in the middle of the comp
var halfTime=qItem.comp.duration/2;
halfTime=halfTime-(halfTime%qItem.comp.frameDuration); // make it a whole frame by subtracting the remainder
qItem.timeSpanStart=halfTime; // Use middle frame
qItem.timeSpanDuration=qItem.comp.frameDuration; // One frame long
When I hit render it will actually create a frame named like this:
c:\temp\clip-thumbnail.jpg00102.jpg
-------------------------------------------------------------------------------------------
Here is a couple of screen caps with a reproducible (for me) symptom.
If 'Output Info:' says 'Single frame' I can edit the filename all I want.
If it says '-' then AE will add _[#####].jpg to whatever name I type.

Is this reproducible for anyone else? Any Ideas?
I am having the same issue. I am scripting the creation of qicktimes etc. and also want to generate a single jpg thumbnail. There seems to be a flag set somewhere (in CS4 at least) that differentiates between rendering a single frame and rendering a sequence that is 1 frame long.
Small section of the code I am using:
var outFile = new File(outputFolder+"/"+outputModule.fileName);
// outfile= c:\temp\[compName]-thumbnail.jpg
qItem.outputModule(idx+1).file = outFile;
// When it is added to the module it converts [compName] to the comp name as it should
// However it ends up looking like this: (lets say the comp is named 'clip')
// c:\temp\clip-thumbnail.jpg_[#####].jpg
// If I trim it off the end and it looks ok in the queue
var messedUpName=qItem.outputModule(idx+1).file.name;
qItem.outputModule(idx+1).file=new File(outputFolder+"/"+messedUpName.replace(/_%5B#####%5D\.[^\._-]+$/i,''));
// Set it to a single frame in the middle of the comp
var halfTime=qItem.comp.duration/2;
halfTime=halfTime-(halfTime%qItem.comp.frameDuration); // make it a whole frame by subtracting the remainder
qItem.timeSpanStart=halfTime; // Use middle frame
qItem.timeSpanDuration=qItem.comp.frameDuration; // One frame long
When I hit render it will actually create a frame named like this:
c:\temp\clip-thumbnail.jpg00102.jpg
-------------------------------------------------------------------------------------------
Here is a couple of screen caps with a reproducible (for me) symptom.
If 'Output Info:' says 'Single frame' I can edit the filename all I want.
If it says '-' then AE will add _[#####].jpg to whatever name I type.

Is this reproducible for anyone else? Any Ideas?
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
This is a known bug. The only way I have been able to work around it to render then correct the file name using File.rename(newName)
-Lloyd
-Lloyd
- almosvagyok
- Posts: 1
- Joined: January 25th, 2016, 5:39 am
hey there! is the any news regarding this question? i'm struggling with the same exact problem, however, in my case, renaming AFTER the render is not an option.
I found this but not the best method.
app.executeCommand(2359);
I found this but not the best method.
app.executeCommand(2359);