Skip to main content
Known Participant
June 12, 2008
Question

[Win Ill 10] How to Call Javscript using Plugin code?

  • June 12, 2008
  • 3 replies
  • 759 views
Hi All,

IDE:Microsoft VC++ 6.0
Illustrator :Version 10

I want to call a javascript from Vc++ code using SDK .I found a sample code to do this in "ASScripting.h" header.

Here is the code:
/***********************************************/
How to use the Scripting suite:

/*To execute a JavaScript script inside a host application, you must acquire
and use a JavaScript engine instance.

A typical use of the engine:*/

ASJavaScriptEngineRef jsEngineRef = NULL;
ASAPI err = kSpNoError;

err = sScriptingSuite->CreateJavaScriptEngine( &jsEngineRef );
if ( err == kSPNoError )
{
const char scriptText[] = "documents.add();" // Script to create a new document
const char * result = NULL;

err = sScriptingSuite->ExecuteJavaScript( jsEngineRef, scriptText, &result );
if ( err == kASScriptExecutionError )
{
// If error during execution, display a dialog containing returned error information string.
ErrorAlert( result );
}
}

...

err = sScriptingSuite->DeleteJavaScriptEngine( jsEngineRef );
jsEngineRef = NULL;
/***********************************************/

But this does not work!I think the "CreateJavascriptEngine" method fails to work.Pls advice on this.Any help is highly appreciated.

Regards
myRiaz
This topic has been closed for replies.

3 replies

A. Patterson
Inspiring
June 17, 2008
Ah, Illustrator 10? I'm afraid I can't help you then, there isn't an ASScripting.h header anymore, at least not in the CS3 SDK (nor in the CS2 SDK I believe).

If you're trying to use it in AI10 or CS it should still work I think. Beyond that, I have no idea. I'm not sure what the replacement is supposed to be.
Known Participant
June 17, 2008
Its there in the following path

\\Adobe Illustrator 10 SDK\IllustratorAPI\General\ASScripting.h
A. Patterson
Inspiring
June 16, 2008
Where did you get ASScripting.h? I can't find it in the SDK!