Forum Replies Created

  • Florian Zeiler

    February 18, 2020 at 1:32 pm in reply to: PropertyValueType not working as expected

    Yes, it seems to be for the 2-dimensional point control for example – i just tried to pass the value from “Scale” to a point control and it actually just takes a 2-value array, so that is that.

    Thanks for your kind help, Andrei – much appreciated!

  • Florian Zeiler

    February 18, 2020 at 11:35 am in reply to: PropertyValueType not working as expected

    That’s great to know – i need to create layer controls that grab the original value (at the time of script execution) from the selected property, so your code snippet is very helpful as well. Thanks a lot ☺

    By the way – if all of these properties like Scale and Position are already 3-dimensional values by default – for which properties do we actually need the .TwoD and .TwoD_SPATIAL enumerations?

    Thanks again, Andrei!

  • Florian Zeiler

    February 18, 2020 at 7:30 am in reply to: PropertyValueType not working as expected

    Thanks for your quick reply, Andrei.

    That makes absolute sense, thank you for the clarification. So in my code, i should probably check if the selected property’s layer is a 3D layer as well?

    After i create the point-control for the scale of a 2D-Layer, i still only connect the values to the first two values of the scale array, correct? By that, i mean [value[0],value[1]] for the 2D Layer. And if the layer has the 3D-switch turned on, i connect three values to the scale? ( [value[0],value[1],value[2]]

    Thanks in advance

    Kind regards

    Florian

  • Ah, thanks so much for that!

    But it’s rather unexpected behaviour, isn’t it? Especially since the other methods do not perform that way..

    Anyway, your edit works perfectly as expected – thank you so much for your time and effort! ☺

    Regards

    Florian

  • No, this is actually the whole script – the ffx file is residing in a folder and can be accessed by the script. My guess is that there is something fundamentally wrong with the applyPreset() method – every other method i tried (such as remove() for example) works as expected and only affects the non-Shape Layers (with my original script).

    But the applyPreset method affects all layers!

    I am running this in extendscript but also tried Expressionist in Script Mode and the run script method .. all the same!

    Thank you for helping me with this – i am stuck.. ☹

  • Thanks for the help and for cleaning up the code ☺

    Using this script, i get an error at line 22 – “undefined is not an object”

    Did i mess something up?

  • Hello Andrei,

    thank you so much for taking the time to help me with my Script!

    Using your hint (the for loop… i must have missed that ????) i was able to alter my Script. I can now successfully retrieve the layers, that are not Shape layers. But now i am facing another strange problem – maybe you can help me?

    In the code below, you can see that i am applying an expression to all Stroke colors on the Shape layers. That works already. But for all the non-Shape Layers, i want to apply a preset.

    For some reason, the preset is also applied to the Shape layers, even though the alert i put in for testing only prints out the names of the non-Shape Layers.

    Do you have an idea why this is happening? The other methods (.remove() or moveToBeginning() for example) work just as expected and only affect the non-shape layers – but the .applyPreset() affects all layers.. what’s going on?

    Thanks so much in advance!

    {
    app.beginUndoGroup("Link Stroke Color");

    var myComp = app.project.activeItem;
    var numLayer = myComp.selectedLayers;
    var colorExp = '(expression placeholder - for code length reasons :D)"';

    for (var a = 0; a < numLayer.length; a++) {
    if (numLayer[a] instanceof ShapeLayer) {

    function scanPropGroupProperties(propGroup) {
    var i, prop;

    // Iterate over the specified property group's properties
    for (i = 1; i <= propGroup.numProperties; i++) {
    prop = propGroup.property(i);
    if (prop.propertyType === PropertyType.PROPERTY && prop.name === 'Color' && propGroup.canSetEnabled && prop.parentProperty.name.slice(0,6) === 'Stroke') // Found a property
    {
    prop.expression = colorExp
    } else if ((prop.propertyType === PropertyType.INDEXED_GROUP) || (prop.propertyType === PropertyType.NAMED_GROUP)) {
    // Found an indexed or named group, so check its nested properties
    scanPropGroupProperties(prop);
    }
    }
    }

    for (var i = 0; i < numLayer.length; i++) {
    scanPropGroupProperties(numLayer[i]);
    }

    } else {
    alert(numLayer[a].name + " is not a Shape Layer!");
    numLayer[a].applyPreset(File("\fill.ffx"));
    }
    }

    app.endUndoGroup();
    }

  • Florian Zeiler

    March 21, 2018 at 9:49 am in reply to: Select property only in certain property groups

    @Steve

    Thank you so much, that worked perfectly ☺

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