Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Calling an InDesign ExtendScript script from a Java application

Engaged ,
Nov 27, 2013 Nov 27, 2013

Since ExtendScript / Javascript cannot access a database directly, I figured that I would use a Java program to do so, instead.  However, I would need some data gathered from a rather large ExtendScript script that I've already written for InDesign.

Thus, is there any way to create a Java program that will launch InDesign CS6 (if it isn't already running), execute a specific script (.jsx file), then return a value (or values) back to the Java program when it's finished?  I can then have the Java program plug that returned information into a MySQL database table. (I still need to look up how to do that last part, but I'm certain it's possible.)

TOPICS
SDK
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 27, 2013 Nov 27, 2013

The question is tagged with #mac - is that your platform? If so, have a look at javax.script - there is a ScriptEngine for AppleScript, and AppleScript can issue a DoScript event given a javascript. You'll then receive the results as string.

Dirk

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 27, 2013 Nov 27, 2013

Ah, I see.  I need to write an AppleScript script as a sort of messenger that goes between the Java application and ExtendScript script in InDesign.  I had to do something similar when I needed to have an InDesign script call Acrobat for a couple of tasks.

I have a lot more to learn about Java first, though, such as how to implement that package into Java, learning all of the new classes, properties, methods, etc.  Java appears to be many orders of magnitude more complex and ExtendScript, since it's a full-blown programming language instead of just a scripting language.  And I'm only just now (after six months) getting a halfway decent grasp of ExtendScript!  :~/

Thanks for the help Dirk! :~)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 27, 2013 Nov 27, 2013

Not only beginners are overwhelmed by the enormous Java libraries. Don't try the brute force attempt to catch up with the developments of decades, just learn the syntax, basic concepts and core packages. Choose a good IDE and tweak example programs until they break. You'll discover the other classes as you need them.

Btw, even though Steve Werner redirected you here, scripting questions are better posted to the scripting forum. This SDK forum is more about C++ plugins, and general Java programming fits neither. Maybe http://www.developer.com/java ? Top story of today there is an oldie from 2004, http://www.developer.com/java/data/article.php/3417381

Another good site is stackoverflow.com, for example http://stackoverflow.com/questions/11978407

Dirk

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 02, 2013 Dec 02, 2013
LATEST

Thank you, Dirk.  I'll check out those resources.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines