Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects One More Scripting…

  • One More Scripting…

    Posted by Erin Shelby on September 30, 2005 at 9:41 pm

    Dan,

    Thanks for the help on that last one, do you know if the next ver. of AE will have better scripting integration? That’d be swell.

    Anyhow, here’s scripting problem of the day…

    Simply, I’ll have a list (this information can be coded right into the javascript if it makes more sense/easier), it will contain a name of a City, then an X position and a Y position (eg: “New York”, 300, 200, “San Francisco”, 100, 150..) lets say. I also have a text_layer in the project, and basically I want, upon running of the script – if that text_layer = the text layer of that city, I can get the position corrdinates placed in another var (to ultimately move a little crosshair image on that position). I could achive results if I made a rather horrible:

    if textstring = “new york”
    crosshairPos.setValue(300, 200);
    else
    if textstring = “san francisco”
    crosshairPos.setValue(100, 150);
    ….

    Then I realized I’d have to nestle the if/then statements till the cows come home.

    I guess where I’m confused the most on is how to work with what will be a fairly large array/list of information….

    -echo

    Dan Ebberts replied 20 years, 11 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    September 30, 2005 at 10:17 pm

    This is probably not the most efficient method, but it should work for what you’re doing:

    var myCityName,myCrossHairLoc;
    var cityNames = new Array(“Atlanta”,”Boston”,”New York”,”Washington”); //etc.
    var crosshairLoc = new Array([100,100],[200,200],[300,300],[400,400]);
    for (i = 0; i < cityNames.length; i++){ if (myCityName == cityNames[i]){ myCrossHairLoc = crossHairLoc[i]; break; } } I haven't tested this - I'm just typing off the top of my head, but it should give you the idea. Dan

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