Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change numbers in script depending on number in an effect

  • Change numbers in script depending on number in an effect

    Posted by Jacob Danell on July 23, 2013 at 3:50 pm

    I have worked with a script for a while and the only thing I would want to add before I go public with it is an connection between an effect and the script. I have no idea if it’s even possible to do. I have searched around without any success of finding an answer.

    In my script I have a button that adds Linear Wipe to the selected layer. I then have a slider and an EditText-box blinded to each other and the Transition Completion on the Linear Wipe, so when I slide the slider both the numbers in the EditText-box and the percentage in Linear Wipe changes to the same number. The same if I change in the EditText-box. The final thing I would want to do is for it to work the same if I slide the Transition Completion in the Linear Wipe effect.

    This is what I have in my script so far:

    my_palette.grp.optsRow.text_input.onChanging = on_textInput_changed;
    my_palette.grp.optsRow.mySlider.onChanging = mySlider_changed;
    my_palette.grp.strt.startButton.onClick = onStartClick; //Liniar Wipe button on click

    function onStartClick () //When clicking on Linear Wipe button
    {
    var activeItem = app.project.activeItem;
    if (activeItem == null || (activeItem instanceof CompItem) == false) {
    alert("Please select a composition in the timeline.", scriptName);
    } else {
    var selectedLayer = activeItem.selectedLayers[0]; //Selected Layer
    if (selectedLayer == null || (selectedLayer.source instanceof CompItem) == false) {
    alert("Please select a composition in the timeline.", scriptName);
    } else
    app.beginUndoGroup("Add Linar Wipe");
    selectedLayer.Effects.addProperty("ADBE Linear Wipe");
    transitionLW = selectedLayer.property("ADBE Effect Parade").property("ADBE Linear Wipe");
    transitionLW.property("ADBE Linear Wipe-0001").setValue(my_palette.grp.optsRow.mySlider.value);
    var LW_change = transitionLW.property("ADBE Linear Wipe-0001");
    app.stopUndoGroup();

    }
    }

    //
    // This function is called when the user enters text for the scale.
    //
    function on_textInput_changed()
    {
    // Set the scale_factor based on the text.
    var value = this.text;
    if (isNaN(value)) {
    alert(value + " is not a number. Please enter a number. (If the number contain '','' please change to a ''.''", scriptName);
    } else {
    scale_factor = value/100;
    my_palette.grp.optsRow.mySlider.value = Math.round(value);
    transitionLW.property("ADBE Linear Wipe-0001").setValue(value);
    }
    }

    //
    // This function is called when the user slides the scale.
    //
    function mySlider_changed()
    {
    // Set the scale_factor based on the text.
    var value = this.value;
    if (isNaN(value)) {
    alert(value + " is not a number. Please enter a number.", scriptName);
    } else {
    scale_factor = value/100;
    my_palette.grp.optsRow.text_input.text = Math.round(value);
    transitionLW.property("ADBE Linear Wipe-0001").setValue(value);
    }
    }

    Mitch Mann replied 12 years, 10 months ago 2 Members · 3 Replies
  • 3 Replies
  • Mitch Mann

    July 24, 2013 at 1:42 am

    Here’s what I do: Make a “Get” button in your interface. When clicked, it looks for the value in the comp and updates your interface with what it found.

  • Jacob Danell

    July 24, 2013 at 11:34 am

    Is there any way for the script to call out a function, for example every 1 second (real time, not playbacktime)? That way if you start the callout when presssing “Add Linear Wipe” and stop it when pressing the “Finish” button

  • Mitch Mann

    July 24, 2013 at 12:10 pm

    Hmm, thats a curious idea. Dan would probably know if there’s a way to do that. I wonder if the pause would tie up your cursor not letting you do anything else in AE. And the other question is whether the pause would be processor intensive. Its interesting academically, but it sounds like its not crucial to what you’re doing.

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