Skip to main content
Known Participant
December 25, 2010
Question

Passing parameters to Javascript from plugin

  • December 25, 2010
  • 1 reply
  • 762 views

Hi,

I'd like to pass arguments to a javascript from a c++ automation plugin.

I can set the argument like this:

  error = sPSActionDescriptor->PutString(theDescriptor, 'key1', "MyString");

  ....call the script...

but how can i read it in javascript?

And, just out of curiosity, how can I communicate back to the c++ automation plugin results from the javascript?

thanks.

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
December 25, 2010

A couple of ideas..

Create the JavaScript on the fly and write the results to a file or CustomOptions

Write the arguments to a file and read them from the Javascript and write the results back to a file.

Put the arguments to app.putCustomOptions(); have the script and your plugin read/write the required info.

Maybe someone will come up with other options?

Known Participant
December 25, 2010

Hi Paul,

Thanks, I guess i should have specified "besides writing to/from a file".   I want to avoid the performance hit.

I think what I'm asking is the equivalent of get/putCustomOptions on the C++ side so the javascript side can be referencing the same thing.

The code snippet I mentioned doesn't seem to do the trick.

Paul Riggott
Inspiring
December 25, 2010

I haven't used C++ but have has some results with C# and using app.DoJavaScript and being able to return data back to the main program. I would have thought there should be a way of accessing get/putCustomOptions from C++ maybe someone can tell you in the SDK forum?

http://forums.adobe.com/community/photoshop/photoshop_sdk