Skip to main content
Participant
October 18, 2005
Question

JavaScript using ExtendScript Toolkit

  • October 18, 2005
  • 2 replies
  • 610 views
Hi,

I am new to Bridge and i am using JavaScript.
I am not able to include any java libraries like java.util.StringTokenizer or java.sql etc.
I do not know if i can do this here.
Also does someone know how to execute an AppleScript file from my
current javascript code, and, can i execute some executable or access a shared library from javascript using extendscript toolkit?

Thanks in advance.

Regards
Joji Varghese
This topic has been closed for replies.

2 replies

Participant
October 18, 2005
Hi Bob,

Thank you, for such quick reply.
I think i will have go with the last option i.e. using app.system
to execute the executable.

Thanks again.

Regards
Joji Varghese.
Known Participant
October 18, 2005
Joji

Sorry, including Java Libraries is not possible.

Bridge does not support AppleScript.

But... Anything that can be executed from the command line can be executed from JavaScript via app.system() - note that this function always returns undefined and does not return control to JavaScript until the command terminates.

I am wondering what you are meaning by shared library. External??? If so, no. Bridge scripts all execute in the same global namespace, so any library script you load will be available to all scripts in Bridge.

This is why "namespacing" is so important. Every script you write should have a namespace object:

ANameUniqueToMeAndMyScript = {};

Then all of your functions and whatnot are defined off of that namespace object

ANameUniqueToMeAndMyScript.myFunction = function() {
}
ANameUniqueToMeAndMyScript.amount = 12;

This way your functions and global values will not step on anyone else's.

Also there are 3 Adobe provided libraries. You can get them from Adobe Exchange by downloading the Import from Camera script.

AdobeLibrary1.jsx - handy objects and functions
AdobeLibrary2.jsx - xml based persistent storage
AdobeLibrary3.jsx - patches to 1 and 2, and a couple of new functions

Bob
Adobe WAS Scripting