Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects An include statement?

  • An include statement?

    Posted by Steve Isaacs on December 21, 2008 at 5:01 pm

    I’m relatively new to JavaScript and After Effects CS4 and need some help.

    Being a long-time C developer I’m accustomed to using the #include to include header files. There is mention of a similar preprocessor feature in the JavaScript Tools Guide but my attempts to use in the ExtendScript Toolkit have failed. I’m seeing a complaint around the ‘#’ character.

    Let me back up a bit. What I’m trying to accomplish is a mechanism to support reuse of code without having to build a library outside of JavaScript. An example of this is use of a function to read a comma separated values file (CSV) and return an array of values. This is something I could use over and over again but don’t want to copy and paste the code to each of my scripts. My experience has taught me the maintenence problem becomes larger with each copy.

    So, what I really need is a way to build a library of JavaScript functions I can chose from and include as needed in a script I’m working on.

    Any suggestions? Have I overlooked something?

    Thanks

    Nothing’s impossible — it’s just some things are more difficult than others.

    Steve Isaacs replied 17 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 22, 2008 at 12:59 am

    #include should work fine. It may be your path specification that’s giving you trouble. This works for me:

    #include ‘/C/temp/test.jsx’

    Dan

  • Steve Isaacs

    December 22, 2008 at 1:22 am

    Awesome!

    Apparently I did not use a correct format for the path. I was using “f:\path\blah\blah” with the #includepath and #include preprocessor statements. Apparently you are correct and this is what caused the syntax error I was seeing. Using the form you provided as an example works just fine. Using the debugger I can step into the included file.

    Thanks,

    Steve

    Nothing’s impossible — it’s just some things are more difficult than others.

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