Expressions/Scripts/Presets

Moderator: Paul Tuersley

Drumper
Topic Author
Posts: 6
Joined: Sat Nov 27, 2010 7:57 am

### Script for Watch Folder Automation

Hi

Im trying to create a script that automates the "collect files" function for the watch folder and i have some problems. Maybe some of you can give me some tips.

I study what after effects is doing when i create a collected folder:
- its creating a new folder with the same name as the project
- its creating in this folder the after effects file, and two text files.
- (if you activate collect items then it will create a footage folder, but i dont need that)

One of these TXT Files is the RCF (render control file). It looks like it doesnt need the second TXT File for starting the render in the watch folder

Ok, so i thought, i would recreate these steps per script:
Creating a folder:
var myFolder = new Folder(theFolder);myFolder.create(); 

-> works

Saving the after Effects File into that folder:
var myRenderSave = File(newFile);app.project.save(myRenderSave);

-> works

Create the TXT File with the RCF informations:
var myFilePath = "myFolder+"/"+newFile+"_RCF.txt";                        var myFileTXT = new File (myFilePath);                        myFileTXT.open("w");                        myFileTXT.lineFeed = "windows";                        myFileTXT.writeln("After Effects 11.0v1 Render Control File");                        myFileTXT.writeln("max_machines=1");                        myFileTXT.writeln("num_machines=0");                        myFileTXT.writeln("init=0");                        myFileTXT.writeln("html_init=0");                        myFileTXT.writeln('html_name=""');                        myFileTXT.close();

-> works

Everything is looking good so far. It looks like the folder AE is creating by "collecting files"... But it doesnt work!

Does the TXT File has to be in a special format? If yes, how can i do that?
Do i oversee something? if that works, it would be a great workflow optimizer for our production - Per one click i could send renderjobs to our renderserver.

thx for any tips!
Peter

Drumper
Topic Author
Posts: 6
Joined: Sat Nov 27, 2010 7:57 am

### Re: Script for Watch Folder Automation

no one?

drockne
Posts: 13
Joined: Fri Mar 02, 2012 10:10 am

### Re: Script for Watch Folder Automation

This might be a silly question, but why do you need the text file? Won't your AE file have all the needed render settings? Also if your project doesn't have any footage, why does it need to be collected?

Drumper
Topic Author
Posts: 6
Joined: Sat Nov 27, 2010 7:57 am

### Re: Script for Watch Folder Automation

So far i know does the after effects watch folder function need the txt file to pick up a job. if there is no rcf file the watch folder just hops from project to project but says "no render controll file found" or something like that.
Or do you know another way? maybe some adjustments in some settings?

drockne
Posts: 13
Joined: Fri Mar 02, 2012 10:10 am

### Re: Script for Watch Folder Automation

Personally, I've never had much luck with watch folders. It seems that you need to do a full collect files process for it to work. Maybe the issue isn't your text file but instead the fact that you aren't collecting footage files?

I don't use watch folders, instead I have a script that writes a command line command to render the file with the aerender node. This is nice because I can create a .command file with that command in it, then run additional commands afterwards. For example: The command renders the video once in animation codec, then run a compression program to create a deliverable as well as web preview copy.

One possible option for you is to use socket connections to communicate to your render machine. Rather than have it waiting for files to get dropped into this watch folder you could send signal through a socket connection to tell it where to find the file to render. Just some thoughts. Best of luck!

Drumper
Topic Author
Posts: 6
Joined: Sat Nov 27, 2010 7:57 am

### Re: Script for Watch Folder Automation

Hm, i know what you mean with "no luck with watch folder" - its not really reliable.
Which script do you use for the commandline renderer? i have no clue of that commandline thing maybe you could give me a quick overview?
sadly, i have no experience with socket connections. maybe a good url to learn?

drockne
Posts: 13
Joined: Fri Mar 02, 2012 10:10 am

### Re: Script for Watch Folder Automation

There are two PDF's from Adobe that cover most of what there is to know about scripting with aftereffects. The last link shows you how to launch an AErender node from the command line. Basically what I ended up doing was writing a text file that had my command line command in it, saving it as a '.command' file, then using the callSystem method (on page 169 of the AE scripting guide) to escalate the permissions of that command file so it's treated as an executable. Then I use the same callSystem method to run the command file.

The reason I jump through all those hoops rather than just running the render command directly from after effects is because after effects will stop and wait for the results of anything you send via callSystem. So it would halt AE until it was done rendering the file.

Lastly, I haven't done anything with socket connections, so I can't give you much advise there except to start looking at page 194 of the Javascript Tools Guide (second link below).

Drumper
Topic Author
Posts: 6
Joined: Sat Nov 27, 2010 7:57 am

### Re: Script for Watch Folder Automation

Thx for your information. I will study them. BTW: there is already a new Scripting Guide out there - for CS6:

i will come back when i study your infos.

Thx

berniebernie
Posts: 33
Joined: Mon Feb 07, 2005 7:32 am
Contact:

### Re: Script for Watch Folder Automation

i know this 4 years old but in case someone comes across it and still uses watchfolder as a cheap renderfarm I think I have a solution; i'm fairly sure AE is being a little bitch and not picking up projects that have too long a name or funky characters

basically your aep filename should be (as far as I can tell) less than 20 characters long (so your _RCF.txt file 24 characters). Folder names don't matter as far as I can tell. If I use aerender.exe it tells me there's a file permission error but standard afterfx.exe" -m -re -wf "c:\path\to\watchfolder" works
Boom boom boom.

### Who is online

Users browsing this forum: No registered users and 2 guests