JXA: Access to constants/variables in a loaded script.

I have two scripts: A loads B as scriptB.

B has a variable defined as follows (with or without var): PAD_LEFT = 1;


From script A I can access a function in script B:

scriptB.myfunc(1); This works.

scriptB.myfunc(PAD_LEFT); - PAD_LEFT not defined (OK)

scriptB.myfunc(scriptB.PAD_LEFT) runs but what is passed to the function is '[object Object]'.


Is it possible to access global variables defined in a loaded script?


Thanks,

Craig.

macOS Sierra (10.12.1)

Posted on Jun 25, 2017 10:21 AM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

JXA: Access to constants/variables in a loaded script.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.