Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions cs6 scripting – toggle all proxies – can’t find a “ProxyExisting” value

  • cs6 scripting – toggle all proxies – can’t find a “ProxyExisting” value

    Posted by Adam Seeley on November 2, 2012 at 4:28 pm

    Hi,

    Help! 🙂

    I’m very new to scripting in AE (Although have used lot’s of OM type stuff using VB in Softimage).

    I want a simple script to toggle all proxies on & off.

    I’ve dragged my slowly melting brain as far being able to loop through all project elements & turn proxies off, as AE will turn a proxy off whether or not one exists.

    I haven’t found a way to test if there’s an existing proxy to turn one again. The script will stop if there’s no existing proxy attached to a project item.

    Any help would be gratefullt recieved.

    Cheers,

    Adam.

    {
    // ams_ToggleAllProxies.jsx
    //
    // This script one day will toggle all proxies on & off.

    function ams_ToggleAllProxies()
    {

    clearOutput()
    writeLn("ams ToggleAllProxies");

    var oItems = app.project.items;
    var totalItems = oItems.length;
    var temp=1

    writeLn("Number of items is: "+ totalItems)

    for (var i=1; i<oItems.length; i++) {
    $.writeln("item:[" +i+ "] is " + app.project.item(i).name);
    $.writeln("proxyFlag:[" +i+ "] is " + app.project.item(i).useProxy);

    // I WANT TO CHECK A VALUE OF THE PROXY PATH TO SEE IF A PROXY EXISTS BUT I DON'T KNOW HOW.
    //$.writeln("type:[" +i+ "] is " + app.project.item(i).proxySource.path);

    // JUST AN "IF" FOR WHEN I HAVE A PROXY-EXISTING TYPE VALUE TO TEST.
    if (temp=1)
    {
    $.writeln("AAGHH")

    // THIS DOESN'T WORK WHEN NO PROXY EXISTS AND STOPS THE SCRIPT
    app.project.item(i).useProxy=true

    // THIS DOES WORK AND TURNS OFF A PROXY WHETHER THERE'S ONE IN USE OR NOT - HALF WAY THERE
    //app.project.item(i).useProxy=false
    }

    }
    alert("Proxies Toggled")
    }

    ams_ToggleAllProxies();
    }

    Adam Seeley replied 12 years, 5 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    November 2, 2012 at 7:03 pm

    I haven’t tried it, but I think you should be able to do this:

    if(app.project.item(i).proxySource == null) continue; // skip to end of loop

    Dan

  • Adam Seeley

    November 9, 2012 at 1:26 am

    Brilliant, thanks for that…. works perfectly.

    Always tricky getting just the right syntax when your’e learning a new language.

    I now have two scripts, one for turning all proxies on & one to turn them off.

    I can’t believe it’s not already a feature for a hotkey!

    Thanks again,

    Adam.

  • Tilmann Schneider

    December 1, 2013 at 12:31 am

    Hi,

    would you be able to post these two scripts?
    I’m looking for exactly that and can’t find it anywhere.

    That would be great!

    Thanks

    Til

  • Adam Seeley

    December 5, 2013 at 9:54 pm

    Hi,

    And why not…

    Here’s the script to Toggle All Proxies OFF

    Save it into

    ams_turnAllProxies_OFF.jsx

    and stick it into the

    C: -> Program Files -> Adobe -> Adobe After Effects CS6 -> Support Files -> Scripts”

    Folder

    Hope it works for you,

    Adam.

    {
    // ams_ToggleAllProxies_Off.jsx
    //adam_seeeley@yahoo.com
    // This script one day will toggle all proxies on AND off.

    function ams_ToggleAllProxies()
    {

    clearOutput()
    writeLn("ams ToggleAllProxiesbbb");

    var oItems = app.project.items;
    var totalItems = oItems.length;
    var temp=1

    writeLn("Number of items is: "+ totalItems)

    for (var i=1; i<oItems.length; i++) {
    $.writeln("item:[" +i+ "] is " + app.project.item(i).name);
    $.writeln("proxyFlag:[" +i+ "] is " + app.project.item(i).useProxy);

    //if(app.project.item(i).proxySource == null) continue; // skip to end of loop
    app.project.item(i).useProxy=false

    }
    alert("Proxies Toggled")
    }

    ams_ToggleAllProxies();
    }

  • Adam Seeley

    December 5, 2013 at 9:56 pm

    And for turning them all on again…..

    save into a text file:

    ams_turnAllProxies_ON.jsx

    Hope it helps.

    Adam.

    {
    // ams_ToggleAllProxies.jsx
    // adam_seeley@yahoo.com
    // This script one day will toggle all proxies on AND off.

    function ams_ToggleAllProxies()
    {

    clearOutput()
    writeLn("ams ToggleAllProxiesbbb");

    var oItems = app.project.items;
    var totalItems = oItems.length;
    var temp=1

    writeLn("Number of items is: "+ totalItems)

    for (var i=1; i<oItems.length; i++) {
    $.writeln("item:[" +i+ "] is " + app.project.item(i).name);
    $.writeln("proxyFlag:[" +i+ "] is " + app.project.item(i).useProxy);

    if(app.project.item(i).proxySource == null) continue; // skip to end of loop
    app.project.item(i).useProxy=true

    }
    alert("Proxies Toggled")
    }

    ams_ToggleAllProxies();
    }

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy