Forum Replies Created

Page 5 of 32
  • Xavier Gomez

    November 8, 2016 at 9:55 pm in reply to: Scripting: Change group color dynamicly

    You don’t seem to need the parseInt and toFixed(2) things.
    The input color should be an array of numbers [r, g, b,a] all in the range [0,1], not an array of strings.
    Something like this (i dont have a hslToRgb function at hand but you can find one very easily on the web):

    function getHSL(){return [slider_h.value / 100, slider_s.value / 100, slider_l.value / 100];}

    function handleMouseDown(ev,theButton){
    var hsl = getHSL();
    var rgb = hslToRgb(hsl);
    theButton.graphics.backgroundColor = theButton.graphics.newBrush(theButton.graphics.BrushType.SOLID_COLOR, rgb, 1);
    };

    Xavier

  • Xavier Gomez

    November 8, 2016 at 5:05 pm in reply to: Question about % function

    % represents the remainder operator.
    You can use it for any pair of numbers : x%y (y not 0 though).
    If both x and y are positive, it is same as x modulo y, or x-Math.floor(x/y)*y.
    If x or y is negative, it behaves a bit strangely.

    See for instance https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder_()

    Xavier

  • Xavier Gomez

    November 7, 2016 at 4:33 pm in reply to: Scripting: Create new comp and open it

    I forgot to say that there is the ready-to-use function : prompt

    var compName = prompt("Enter the new comp name:", "Some name to start with", "Hi");
    if (compName){
    app.beginUndoGroup("Crear Nueva Composición 1080p");
    app.project.items.addComp(compName, 1920, 1080, 1, 15, 25).openInViewer();
    app.endUndoGroup();
    };

    Xavier

  • Xavier Gomez

    November 7, 2016 at 3:57 pm in reply to: Scripting: Create new comp and open it

    For me “active” works:

    win.show();
    edittext_1.active=true;

    And to automatically trigger onClick when the enter key is pressed, you can use:

    edittext_1.onEnterKey = function(){but_1.notify();};

    Xavier

  • Xavier Gomez

    November 7, 2016 at 2:20 pm in reply to: Scripting: Create new comp and open it

    Use openInViewer():

    myComp.addComp(edittext_1.text, 1920, 1080, 1, 15, 25).openInViewer();

    Xavier

  • Xavier Gomez

    November 3, 2016 at 3:48 pm in reply to: Read a file with After Effects Script?

    The dialog will create a file object, but does not actually opens it for reading. This is another step:

    var file = File.openDialog();
    if (file && file.open(“r”)){
    var content = file.read();
    file.close();
    alert(content);
    };

    Xavier

  • Xavier Gomez

    October 16, 2016 at 6:00 pm in reply to: How to get shape path vertices with script?

    Ah ok…

    if you select a mask path (keyframable), the mask group (renamable) is selected along, and selectedProperties[0] is the mask group, not the mask path.

    Same for paths inside vector layers.

  • Xavier Gomez

    October 16, 2016 at 3:57 pm in reply to: Mouseover on palette

    No.
    No idea ?
    Just so you know, i had tested on Windows 7, AE CC 2014.3

    Xavier

  • Xavier Gomez

    October 16, 2016 at 3:54 pm in reply to: How to get shape path vertices with script?

    What property are you selecting ? Normally your code line should work if you select a mask path property or a shape path property.

    It won’t work for special shapes like Ellipse/Rectangle/Star (you’d need to convert them to a path before).

    Xavier

  • Xavier Gomez

    October 3, 2016 at 1:21 pm in reply to: Image path problem in After Effects script.

    fsName is mostly for display i think.
    To make sure that your path will work on any system, absoluteURI is better:

    var scriptPath = File($.fileName).parent.absoluteURI;

    or (same result):
    var scriptPath = File($.fileName).path;

    then when appending the relative path, it’s better to escape the added string:

    var imagePath = scriptPath + encodeURI("/myfolder/imagename.png");

    Xavier

Page 5 of 32

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