Skip to main content
Known Participant
November 26, 2021
Answered

Apply Preset twice without overwriting the previous preset applied

  • November 26, 2021
  • 1 reply
  • 336 views

Hi, I have a script that is applying preset of a text animator, it does that twice in two different functions.

the problem is that in the second time, it applies the preset but instead of adding an animator, it overwrites the current one. (there should be two identical animators at the end).

any idea on what to do?

 

this function exists twice:

var scriptFolderPath = File($.fileName).path; // the URI of the folder that contains the script file  

        var presetsFolder = scriptFolderPath + encodeURI(*PRESETFOLDER*); // the URI of the folder for

        var presetPath = presetsFolder + "Preset.ffx";
        var preset = File(presetPath);
        layer.applyPreset(preset);

 

This topic has been closed for replies.
Correct answer Paul Tuersley

Maybe put this in before applying each preset to make sure the previous animator isn't still selected?

while (layer.selectedProperties.length > 0){
  layer.selectedProperties[0].selected = false;
}

 

1 reply

Paul TuersleyCorrect answer
Inspiring
November 26, 2021

Maybe put this in before applying each preset to make sure the previous animator isn't still selected?

while (layer.selectedProperties.length > 0){
  layer.selectedProperties[0].selected = false;
}

 

Known Participant
November 27, 2021

Thank you so much!