waterye

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

posted on 2005-09-10 22:36 waterye 阅读(723) 评论(0)  编辑  收藏 所属分类: groovy


只有注册用户登录后才能发表评论。


网站导航: