Skip to content

Instantly share code, notes, and snippets.

@osima
Created October 30, 2010 19:03
Show Gist options
  • Select an option

  • Save osima/655633 to your computer and use it in GitHub Desktop.

Select an option

Save osima/655633 to your computer and use it in GitHub Desktop.
GroovyからInDesignを実行する
import org.codehaus.groovy.scriptom.*
//
// 引数として渡されたJSファイルのチェック
//
boolean ng=false
if( args.size()<1 ){ ng=true }
else if( new File(args[0]).exists()==false ){ ng=true }
if(ng){
System.exit(0)
}
//
// ExtendScriptの実行
//
Scriptom.inApartment
{
def myJS = new File(args[0]).text
int lang = 1246973031 // javascript
//def indapp = new ActiveXObject('InDesign.Application')
//def indapp = new ActiveXObject('InDesign.Application.CS4_J')
def indapp = new ActiveXObject('InDesign.Application.CS3_J')
indapp.doScript(myJS, lang )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment