Perl to InDesign CS4 example (OS X)


/ Published in: Perl
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.