Copy link to clipboard
Copied
Hi
Chapter 7 of the Javascript tools guide talks about using external shared libraries.
Direct access to library calls through the ExternalObject instance — Use the direct-access style
for C-language libraries. For each function defined in the C library, there is a corresponding method in
the ExternalObject object. You can pass data to these methods and receive the return value directly.
For example:
mylib = new ExternalObject ("lib:" + samplelib); // load the library
It also states
"Indirect access to library calls through JavaScript classes — Use the indirect style to access classes defined in a C++ library. For each C++ class defined in the library, a corresponding JavaScript class is automatically defined, and you can access the properties and methods through an instance of that
class."
Does anyone have a sample (source code) of an external library preferably both for direct and indirect access that can be access using the new ExternalObject ("lib:" + samplelib); method?
TIA
Trevor
Hi Harbs
Thanks for taking a look.
That's not what I was after (I've used "ready made" libraries quite a bit)
I am looking for is how to make my own library.
So I'm looking for an example of the raw c / c++ code using in making a library.
A "Hello World" example would be great.
Hey, what a jerk, me not you I just noticed that right at the beginning of chapter 7 it says
...
Example code
The sample code distributed with the Adobe ExtendScript SDK includes an example that demonstrates
how write a C/C++ shared l
Copy link to clipboard
Copied
From the CEP for Developers docs:
The above example assumes that you have loaded the PlugPlug External Object library. In InDesign CC 2014.1/CEP 5.2, this library can be loaded using the following:
var plugplugLibrary = new ExternalObject("lib:\PlugPlugExternalObject");
In earlier versions of InDesign CC, you will have to load the PlugPlug External Object library as a file:
//Where "file" is the File object containing the library:
var plugplugLibrary = new ExternalObject("lib:" + file.fullName);
Does that answer your question?
Harbs
Copy link to clipboard
Copied
A bit more:
Indirect access would be something like this (once the library is loaded):
var csxsEvent = new CSXSEvent();
csxsEvent.type = idSelectionChanged";
csxsEvent.data = "Selection changed!";
csxsEvent.dispatch();
This works because CSXEvent is defined as a C++ class in PlugPlug.
If there would be methods in PlugPlug, you could do something like this for direct access:
plugplugLibrary.doSomething()
HTH,
Harbs
Copy link to clipboard
Copied
Hi Harbs
Thanks for taking a look.
That's not what I was after (I've used "ready made" libraries quite a bit)
I am looking for is how to make my own library.
So I'm looking for an example of the raw c / c++ code using in making a library.
A "Hello World" example would be great.
Hey, what a jerk, me not you I just noticed that right at the beginning of chapter 7 it says
Example code
The sample code distributed with the Adobe ExtendScript SDK includes an example that demonstrates
how write a C/C++ shared library to be integrated with JavaScript. It is in the directory:
sdkInstall/sdksamples/cpp/
The sample shows how to write a plug-in for Adobe Bridge in C/C++, using the ExternalObject
mechanism, which enables the C/C++ code to be called from the JavaScript context. Project files for
Microsoft Visual Studio 2005 and XCode 2.4 are included in subfolders of
sdkInstall/sdksamples/cpp/build.
If I get stuck I'll add another post.
Thanks again,
Trevor
Copy link to clipboard
Copied
Where is the Example code
I can't find it in After Effects 7.0r3 SDK\ Examples
Copy link to clipboard
Copied
The ExtendScript SDK typically is a separate package.
Watch out for "basicexternalobject" in a "SDK" folder near your ExtendScript Toolkit installation.
Bridge also has a similar download at Adobe I/O Console
Looking at folder level there are already differences, maybe you get something working with a cross-breed?
Good luck