Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions variable to return string with ascending values (set01, set02, etc.)

  • variable to return string with ascending values (set01, set02, etc.)

    Posted by Steve Renard on August 12, 2010 at 5:21 pm

    Hi all – I’m not sure if I’m even asking the question right, but here’s my issue…
    I have a txt file outside of AE that has a collection of arrays in it, which are named and numbered. It looks something like this:
    set01 = [4336,43.59,-103.42,0,1208.84,0,0,19,11,04,100,10,0,0,30,10,0,0,0,0]
    set02 = [4726,40.11,-75.44,400,0,135,2.5,19,11,04,100,10,0,0,0,5,40,5,0,0]
    set03 = [4733,37.45,-113.17,0,1900….etc. etc. etc.

    For each array, I would like to have one null layer with a bunch of slider controls on it, with each slider control calling a value from the array. I have some code that works in the box below, but I would much rather write a variable that would return the text “set01” rather than having to change the last line of code for every null object (there are quite a few arrays). I would like the number to be based on the layer index, so that I can simply set up one layer with the right expression on the slider controls, and copy it a bunch of times. It seems like there should be a way to do this… am I wrong?

    myPath = "/Macintosh HD/Users/render/Desktop/SR/Data Mapping Stuff/ecoDataCollection.txt";
    $.evalFile(myPath);
    arrayValue = thisProperty.propertyGroup(1).propertyIndex-1;
    set01[arrayValue]

    Steve Renard replied 15 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    August 12, 2010 at 5:53 pm

    Try replacing your last line with this:

    id = “” + index;
    if (id.length < 2) id = “0” + id;
    eval(“set” + id + “[arrayValue]”)

    Dan

  • Steve Renard

    August 12, 2010 at 6:25 pm

    That’s perfect – thanks Dan!

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