Skip to main content
Known Participant
July 4, 2022
Answered

AE Scripting assessing Expression Controls

  • July 4, 2022
  • 1 reply
  • 685 views

Hello,

How can I have whatever is selected in the Expression Controls > Dropdown Menu Control (which was renamed to Layer Source For Grid) as a variable.

After that how do I access the VALUE of the selected layer in this case "BOX" Expression Controls > Slider Control > Rows and Columns.

Right now I have something like this, any help with what I am doing wrong is appreciated.

startButton.onClick = function(){
var comp = app.project.activeItem;
var layGrid = comp.selectedLayers[0];

var laySelect = layGrid.property("Effects").property("Layer Source For Grid").property("Layer");
var selectR = laySelect.property("Effects").property("ROWS").property("Slider");
var selectC = laySelect.property("Effects").property("COLUMNS").property("Slider");

 

I have attached 2 screenshots as a reference.

Thank you in advance.

This topic has been closed for replies.
Correct answer Mathias Moehl

the value of a layer control dropdown is the index of the selected layer.

Hence, you should be able to do something like

var laySelectIndex = layGrid.property("Effects").property("Layer Source For Grid").property("Layer").value;

var laySelect = comp.layer(laySelectIndex);
var selectR = laySelect.property("Effects").property("ROWS").property("Slider").value;
var selectC = laySelect.property("Effects").property("COLUMNS").property("Slider").value;

1 reply

Mathias Moehl
Community Expert
Mathias MoehlCommunity ExpertCorrect answer
Community Expert
July 5, 2022

the value of a layer control dropdown is the index of the selected layer.

Hence, you should be able to do something like

var laySelectIndex = layGrid.property("Effects").property("Layer Source For Grid").property("Layer").value;

var laySelect = comp.layer(laySelectIndex);
var selectR = laySelect.property("Effects").property("ROWS").property("Slider").value;
var selectC = laySelect.property("Effects").property("COLUMNS").property("Slider").value;

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Known Participant
July 5, 2022

Perfect. Thank you, good man.