Groovy Com Scripting

Groovy Com Scripting

使用 Scriptom和Jacob在groovy调用ActiveX 或 COM component(只能在Windows下运行)

需要的jar和dll
a. groovy-all-1.0-jsr-03.jar,jacob.jar,jacob.dll,asm.jar
b. jacob.dll needs to be in the bin directory, or in your java.library.path

ie.groovy
import org.codehaus.groovy.scriptom.ActiveXProxy

//  instanciate Internet Explorer
explorer  =   new  ActiveXProxy( " InternetExplorer.Application " )

//  set its properties
explorer.Visible  =   true
explorer.AddressBar 
=   true

//  navigate to a site
explorer.Navigate( " http://waterye.blogjava.net " )
Thread.sleep(
1000 )
explorer.StatusText 
=   " Water Ye's blog "
Thread.sleep(
2000 )

//  quit Internet Explorer
explorer.Quit()


测试环境:
1. scriptom:groovy_cvs\modules\scriptom
2. ide:        groovyj
3. jdk:       jdk1.5.0_01

详细版本: http://groovy.codehaus.org/COM+Scripting

你可能感兴趣的:(Groovy Com Scripting)