AE ENHANCERS

Expressions/Scripts/Presets
It is currently Sun May 19, 2013 2:10 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Automatic 'Send To Watchfolder'
PostPosted: Mon Apr 16, 2012 3:53 pm 
Offline

Joined: Mon Feb 07, 2005 7:32 am
Posts: 29
I posted on reddit: http://www.reddit.com/r/AfterEffects/co ... _of_comps/ but if you're on AEnhancers you know better; basically it's a tiny tool to send your project to a watchfolder without have to do a nasty collect files.

Image

Save as .jsx in the scriptsUI folder

Code:
/*
Watchfolder.js v1.0
--------------------
By bernie @ berniebernie.fr

This script is a simple palette to automatically send your after effects file to be processed by the watchfolder
In essence it's a simplified Collect Files > Project only.
*/
{                 
watchfolderLocation = "none";
watchfolderLocation = (app.settings.haveSetting("watchfolderPrefs", "watchfolderLocation"))?(app.settings.getSetting("watchfolderPrefs", "watchfolderLocation")):watchfolderLocation;

function sendToWF(wf){
        var c = confirm(app.project.file.name+" needs to be saved first. Save ?",false,"Save Project");
        var saved = app.project.file.toString();
        if(c){
            app.project.save();
            var curFile = app.project.file.name;
            curFile = curFile.substring(0,curFile.length-4);
            var myFolder = new Folder(wf+"/"+curFile+"_watch/");
            myFolder.create();
            curFile += "_watchfolder";
            var mySaveFile = new File(myFolder.toString()+"/"+curFile+".aep");       
            app.project.save(mySaveFile);
            var myTextFile = new File(myFolder.toString()+"/"+curFile.substring(0,22)+"_RCF.txt");   
            myTextFile.open("w","TEXT","????");
            var text = "After Effects 10.0v1 Render Control File\nmax_machines=5\nnum_machines=0\ninit=0\nhtml_init=0\nhtml_name=\"\"\n" ;
            myTextFile.write(text);
            myTextFile.close();
            app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
            var opFile = new File(saved);
            if(opFile){
                app.open(opFile);
            }           
            writeln("Sent to watchfolder...");           
    }
}
function setWatchFolder(){
        var y = confirm("Watchfolder is currently set to \n\n\""+watchfolderLocation+"\"\n\nChange it ?");
        if(y){
            var v = Folder.selectDialog ("New watchfolder location").toString();
            if(v!=null && v!="undefined"){
                app.settings.saveSetting("watchfolderPrefs", "watchfolderLocation",v);     
                watchfolderLocation = v;
            }
        }
    }
function watchFolderUI(thisObj){
    pan = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Watchfolder", [100, 100, 300, 300]);
    var securitySetting = app.preferences.getPrefAsLong("Main Pref Section", "Pref_SCRIPTING_FILE_NETWORK_SECURITY");
    if (securitySetting != 1) {
        pan.add("statictext",[15,15,300,45],"Set prefs and re-launch");
        alert("You need to check \"Allow Scripts to Write Files and Access Network\" in your preferences for this script to work");
     }else{
                var res =
            "group { \
                        alignment: ['fill','fill'], \
                        alignChildren: ['fill','top'], \
                        orientation: 'column', \
                            setWF: Button {text: 'Set watchfolder' ,preferredSize:[-1,30]} , \
                            sendWF: Button {text: 'Send To Watchfolder' ,preferredSize:[-1,30]} , \
                    }";   
            pan.grp = pan.add(res);       
            pan.grp.setWF.onClick = function () {
                    setWatchFolder();
                    }
            pan.grp.sendWF.onClick = function () {
                if(watchfolderLocation=="none"){
                    setWatchFolder();
                    }else{
                       
                    sendToWF(watchfolderLocation);
                }}
            pan.layout.layout(true);
            pan.layout.resize();
            pan.onResizing = pan.onResize = function () {this.layout.resize();}
            return pan;
    }
}
watchFolderUI(this) ;
}

_________________
Boom boom boom.


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users 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