AE ENHANCERS

Expressions/Scripts/Presets
It is currently Sat May 18, 2013 11:50 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Batch Process AE projects
PostPosted: Wed Jul 21, 2010 5:20 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
Is it possible to open After Effects projects with a script?

I use a script for Photoshop that searches through a selected folder, finds a psd, exports a jpeg, closes the file and then moves onto the next psd. I was hoping to be able to do something similar with AE. What I want to do is open all my projects and switch off the text layers (I have a scene number slate in the main comp), save and close. Any ideas?

Ed

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Wed Jul 21, 2010 3:39 pm 
Offline
Enhancement master
User avatar

Joined: Thu Jun 17, 2004 9:27 am
Posts: 456
Location: New York City, NY
Page 26 of the CS3 Scripting Guide:

Application open() method

app.open()
app.open(file)

Description
Opens a project.
Returns
A new Project object for the specified project, or null if the user cancels the Open dialog box.

_________________
http://aescripts.com


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Thu Jul 22, 2010 12:47 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
Appreciate it Lloyd.

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Mon Sep 06, 2010 4:19 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
I'm currently trying to get After Effects to automatically generate the aerender cmd file. The main problem I'm having is how to get the actual "current project" file path and name, I think I'm messing up on some of the escape characters aswell but I'm not sure.

Any help greatly appreciated.

Here's a section of the code I'm using:

Code:
//Create New txt document
var document = new File("W:/path/ED/renderQueue.txt");
//Variable to hold carriage return character
var carReturn = "\r";

//current project file path
var projPath = app.project.file.fsName;

//Check if document already exists
if(document.exists){   //If it does, append more text to it
   document.open("a");
document.write(carReturn + " \"aerender.exe -project \" + projPath\" -mem_usage 60 120  -v ERRORS_AND_PROGRESS");
   document.close();
   alert("New text was appended");
}else if(!document.exists){   //If it doesn't, create a brand new document and add this text
   document.open("w");
   document.write("c:\r\rcd \"C:\Program Files\Adobe\Adobe After Effects CS5\Support Files\"");
   document.close();
   alert("Brand new document saved.");
}

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Mon Sep 06, 2010 8:05 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 645
Location: London, UK
I don't use aerender so I don't know exactly what to write, but I'll have a go. One thing I'd suggest is try using writeln() instead of write() as I've had more luck with that than trying to add line returns (it may only be a cross platform issue).

Also, as I don't think you actually want any escaped " on this line, I'm guessing it should be:
document.write(carReturn + "aerender.exe -project " + projPath + " -mem_usage 60 120 -v ERRORS_AND_PROGRESS");


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Tue Sep 07, 2010 12:43 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
Actually managed to get it working. It was pretty close. Now I'm just trying to perfect the "Folder.selectDialogue" so I can choose where to save the aerender.cmd file rather than always having to change the path in the script. Here's what's working so far on the text front:

Code:
//Create New txt document
var document = new File("W:path/ED/renderQueue.txt");
//Variable to hold carriage return character
var carReturn = "\r";

//current project file path
var curProj = app.project;
var projPath = curProj.file.fsName;

//Check if document already exists
if(document.exists){   //If it does, append more text to it
   document.open("a");
document.write(carReturn + "aerender.exe -project \"" + projPath + "\" -mem_usage 60 120  -v ERRORS_AND_PROGRESS");
   document.close();
   alert("New text was appended");
}else if(!document.exists){   //If it doesn't, create a brand new document and add this text
   document.open("w");
   document.write("c:\r\rcd \"C:\\Program Files\\Adobe\\Adobe After Effects CS5\\Support Files\"");
   document.close();
   alert("Brand new document saved.");
}

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Tue Sep 07, 2010 1:29 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
After I've defined Folder.selecDialog, how do I use that object?

For example, I want to create the new RenderQ.cmd file in the location I've picked:

Code:
var Qlocation = Folder.selectDialog ("Select Render Q Location");

var document = new File([QLocation] HDRenderQueue.cmd);

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Tue Sep 07, 2010 2:14 am 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 645
Location: London, UK
Try this:
Code:
{
   var Qlocation = Folder.selectDialog ("Select Render Q Location");
   if (Qlocation != null ) {
      var document = new File(Qlocation.fsName + "/HDRenderQueue.cmd");
      alert(document.fsName);
   }
}

I recommend using lots of alerts to try to figure out what's going on. And write little test scripts like this:
Code:
{   
   var testFile = File.openDialog("Select A File");
   if (testFile != null) {
      alert(testFile.fsName);
   }
   var testFolder = Folder.selectDialog("Select A Folder");   
   if (testFolder != null) {
      alert(testFolder.fsName);
   }
}


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Tue Sep 07, 2010 2:35 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
Thanks Paul that's just what I was looking for. I've been doing little tests like you've suggested on other parts of the script (like opening projects and swithcing off selected layers, adding to render queue, things like that) but I was just having trouble with using the folder object returned with selectDialog.

When I get the script finished I'll post it, maybe it'll be of use to someone. I'm basically switching off scene numbers and some handheld parameters (that were initially requested but SOMEONE decided to change their minds) and submitting the comp to the render queue with HD output settings. While also generating the aerender.cmd file. When the AE script finishes it'll execute the aerender queue. One of the latest "headslap" moments was finding out I need to remove the "autosave" string from the search "*.aep" so getFiles doesn't include them. Always learning.

I think I might do another version of the script and assign a keyboard shortcut (using Keyed Up) to it so that while working in a comp you could just generate the line needed in your queue.

Thanks again

Ed

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Fri Sep 10, 2010 3:31 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
I realise that Lloyds BG Renderer is probably a better/different way to do this, but since it's a by product of a bigger script I'm writing (and since I'm very rarely in a position to actually contribute anything to this forum) here's my script to add scenes to an aerender file that you specify. It's probably not coded very well and if you hit cancel on the "select render q location" dialogue it throws a li'l error ( to be fixed when i get the time). But I'm happy enough with it, especially when used with KeyEd Up.

Code:
{
   var Qlocation = Folder.selectDialog ("Select Render Q Location");
   if (Qlocation != null ) {
      var document = new File(Qlocation.fsName + "/RenderQueue.cmd");
      {
    if(document.exists){   //If Render Queue already exists, alert
        alert("Render Queue already exists, scene will be added to " + document.fsName +" using your current settings");

    }else if(!document.exists){   //If it doesn't, create a brand new aerender queue and alert
        alert("Created New Render Queue " + document.fsName);
  }
}
   
   }

var curProj = app.project;
var projPath = curProj.file.fsName;

var carReturn = "\r";
//Check if Queue already exists
{
    if(document.exists){   //If it does, append more text to it
   document.open("a");
document.write(carReturn + "aerender.exe -project \"" + projPath + "\" -mem_usage 60 120  -v ERRORS_AND_PROGRESS");
   document.close();
    }else if(!document.exists){   //If it doesn't, create a brand new document and add this text
   document.open("w");
   document.write("c:\r\rcd \"C:\\Program Files\\Adobe\\Adobe After Effects CS5\\Support Files\"");
   document.write(carReturn + "aerender.exe -project \"" + projPath + "\" -mem_usage 60 120  -v ERRORS_AND_PROGRESS");
   document.close();
  }
   alert("Added " + curProj.file.name + " to your Render Queue.  You, my friend, are compositing your ass off today!!")
}
}


Thanks a million to Paul for all his help so far.

Ed

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Batch Process AE projects
PostPosted: Tue Jun 21, 2011 2:10 am 
Offline

Joined: Mon Apr 25, 2011 4:17 am
Posts: 2
Location: Paris, France
Just to say that you bright my day! :D

_________________
Julien


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group