Skip to main content
April 4, 2011
Question

Anyone used a Microsoft DLL using the ExternalObject object?

  • April 4, 2011
  • 5 replies
  • 3221 views

There are a number of DLL libraries in Windows that are commonly used by jaavascipt and vbscript programmers:

ActiveX Data Objects, Excel API library, Word API library, XML, SOAP library, Scritping Runtime.

Anyone know of a way to access these from the ESTK?

This topic has been closed for replies.

5 replies

Known Participant
September 16, 2011

Hi,

I bumped into this thread while searching for an answer on integrating ESTK with RealStudio (an external commercial IDE). While my problem does not belong to Microsoft DLL any way, and not necessarily to InDesign forum in particular, I would certainly like to get in touch with people who managed to integrate ESTK with outer world.

Has any of you used any external IDE as an UI tool, send/receive data to/from ESTK and trigger scripts externally?

Please feel free to move this discussion to another more appropriate forum. BTW think we could have a general forum for ExtendScript as an environment.

Regards,

moniuch

Participating Frequently
May 25, 2011

Hi partswiz,

Is there some reason you want to use the JavaScript/ExtendScript external object with a DLL? Given that you mention VBScript, why not just use VBScript? If you do that, you can use the libraries as you'd use any other libraries from VBScript--lots of examples are around (the samples that get installed with InDesign use the FileSystemObject, for example).

Thanks,

Ole

Inspiring
May 22, 2011

Samples available here.

we have used it, its working great..

<adobe instalation drive/folder>\Adobe\Adobe Utilities\ExtendScript Toolkit CS4\SDK\Samples\cpp\build\basicexternalobject\win

John Hawkinson
Inspiring
May 22, 2011

zyberkid: A little more context would be good.

Are you saying you've used 3rd party DLLs in ExendScript directly, without writing wrappers? That would be good to see an example of.

Or are you saying that you've been able to build your own DLLs following the ExtendScript API as documented in the Bridge SDK? That is unremarkable and already noted above in the thread...

Inspiring
May 22, 2011

yes, i have tried to load a .net Dll and tried calling a method, and it worked,

these are the steps,

first you should look for the correct .net framework installed in the machine.

load the framework,

then load the library,/ namespace.

allocate application domain space for running.

then create instance for that library(external microsoft dll)

then call the method,

i would probably post the sample code..

Marc Autret
Legend
April 5, 2011

Anyway it is correct that ExtendScript offers an ExternalObject object which allows to load a DLL into JavaScript —direct-access style for C-language libraries and indirect-access style for C++ libraries. Is this feature Bridge specific, I don't know... For more details see "Integrating External Libraries" in the JavaScript Tools Guide.

@+

Marc

John Hawkinson
Inspiring
April 5, 2011

Marc is of course correct, you can also add your own DLLs to ExtendScript.

Sorry for not mentioning that!

It's certainly more available than just Bridge, you can extend

InDesign too.

I believe the API is Adobe-specific, though, and you're not going to

be able to load other DLLs...

(On the other hand, I suppose you could write a wrapper DLL to

address this...)

More practically, unless performance is an issue, it's probably easier

to call VB from JavaScript.

I have the impression this API is a bit more sketchy than you would

like to believe -- for instance, the "webaccesslib" library (providing

FtpConnetion and HttpConnection) only works in Bridge. I did try

moving the file around and then loading it in InDesign, and failed.

Perhaps I just wasn't creative enough, but it seemed weirdly fragile -- why

would it not work in InDesign but would work in Bridge?

John Hawkinson
Inspiring
May 22, 2011

I wrote:

I have the impression this API is a bit more sketchy than you would

like to believe -- for instance, the "webaccesslib" library (providing

FtpConnetion and HttpConnection) only works in Bridge. I did try

moving the file around and then loading it in InDesign, and failed.

Perhaps I just wasn't creative enough, but it seemed weirdly fragile -- why

would it not work in InDesign but would work in Bridge?

So, I hadn't really looked at it for CS5 when I wrote this, and now I'm even more confused.

In CS5, the documentation of webaccesslib is moved out of the Javascript Tools Guide and into the Bridge Javascript Reference (not Guide), so if you don't read that you'd never know. Maybe ESClientInterface() is returning an error that's not kESErrOK when it's not called from Bridge?

I guess I should actually poke around inside it...unless anyone knows?

John Hawkinson
Inspiring
April 4, 2011

Isn't this the same as your other thread?

Anyhow, sorry, no. InDesign's JavaScript implemenation is self-contained and doesn't give you access to these kinds of extensions. It is really just pure javascript, plus the InDesign DOM, E4X, and a few Adobe extensions, like their Http and Socket libraries.