Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Is there any way to identify what property is selected with scripting?

Explorer ,
Dec 13, 2020 Dec 13, 2020

I'm writing a script to be able to change the value of a property based on a user input, and I'm wondering if there's a way to identify exactly what property is selected.

 

I mainly want to identify if they have scale selected so that instead of needing to input an x and y value you can just input one so it'll slot into both spots.

TOPICS
Error or problem , How to , Scripting
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 14, 2020 Dec 14, 2020

you can check the matchName of the property

if(props[i].matchName == "ADBE Scale") {...}
Translate
Advocate ,
Dec 13, 2020 Dec 13, 2020

In your curent composition, you can retrieve an array of selected properties with: app.project.item(index).selectedProperties

Or on a layer, with  app.project.item(index).layer(index).selectedProperties

More info here: https://ae-scripting.docsforadobe.dev/layers/layer/#layer-selectedproperties and here https://ae-scripting.docsforadobe.dev/items/compitem/#compitem-selectedproperties

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2020 Dec 13, 2020

Thanks for the quick reply Tomas! I know you can get an array of selected properties, but I'm more wondering if there's some of way of specifically seeing if one of those is the scale property for example.

 

something like:

var props = app.project.activeItem.selectedProperties;
for (i=0; i<props.length; i++)
     {
      if (props[i]==scale)
           {
            do something
            }
     }

 Obviously I know it wouldn't be this exactly I'm just wondering if I can do something along these lines

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 14, 2020 Dec 14, 2020

you can check the matchName of the property

if(props[i].matchName == "ADBE Scale") {...}
Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 14, 2020 Dec 14, 2020
LATEST

You're my hero

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines