Posted By

myhd on 08/24/09


Tagged

javascript hack mac osx perl design heredocs indesign


Versions (?)

Perl to InDesign CS4 example (OS X)


 / Published in: Perl
 

This example demonstrates a way to control Adobe InDesign from Perl. Tested on MacOS X 10.5.7 and INDD.

  1. #!/opt/local/bin/perl -w
  2. # ^^^ your hashbang may vary
  3.  
  4. use strict;
  5. use warnings;
  6.  
  7.  
  8. `/usr/bin/osascript <<-HereDoc
  9.  
  10. tell application "Adobe InDesign CS4"
  11. do script "
  12.  
  13. // start your javascript code controlling InDesign here
  14.  
  15. var myObject = app.selection[0]; // grabs selected object in INDD
  16. alert(myObject); // show object kind
  17.  
  18. // javascript code ends here
  19.  
  20. " language javascript
  21. end tell
  22.  
  23. HereDoc`;

Report this snippet  

You need to login to post a comment.