4 messages in org.codehaus.groovy.devRE: [groovy-dev] [ANN] Scriptom: COM ...
FromSent OnAttachments
Guillaume LaforgeDec 30, 2004 10:14 am 
Dierk KoenigJan 3, 2005 7:01 am 
Guillaume LaforgeJan 3, 2005 7:15 am 
Dierk KoenigJan 3, 2005 7:47 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:RE: [groovy-dev] [ANN] Scriptom: COM Scripting in GroovyActions...
From:Dierk Koenig (dier@canoo.com)
Date:Jan 3, 2005 7:01:53 am
List:org.codehaus.groovy.dev

Scriptom is cool :-) Many Thanks to Guillaume for integrating the Groovy API.

I found that it can be used to call the Windows Scripting Host for Keystroke-Macros (even if you don't have a COM reference like for "notepad" in this example):

--- import org.codehaus.groovy.scriptom.ActiveXProxy

ALT = '%' SHIFT = '+' CTRL = '^'

'cmd /k notepad.exe'.execute()

// Windows Scripting Host shell host = new ActiveXProxy("WScript.Shell") host.AppActivate("Notepad")

Thread.sleep(1000)

// some keystrokes host.sendKeys('0/0{TAB}0/1{ENTER}1/0{TAB}1/1{ENTER}')

// function key to insert current date host.sendKeys('{F5}')

// replace all 0's by x host.sendKeys(CTRL+'h') host.sendKeys('0{TAB}x') host.sendKeys(ALT+'a') host.sendKeys('{ESC}') ---

cheers Mittie

-----Original Message----- From: Guillaume Laforge [mailto:glaf@codehaus.org] Sent: Donnerstag, 30. Dezember 2004 19:15 To: us@groovy.codehaus.org; de@groovy.codehaus.org Subject: [groovy-dev] [ANN] Scriptom: COM Scripting in Groovy

Hello all, particularly Windows users,

Here is a new toy--a late Christmas gift--for you to play with. Scriptom is targeted exclusively at the users working under Windows.

Scriptom is a new module that allows you to use Groovy to script COM or ActiveX components, while still leveraging all the java libraries available!

To learn more about Scriptom, how to get it, to install it, and to play with a few examples, I've written some extensive documentation on Confluence:

http://groovy.codehaus.org/COM+Scripting

Just to give you a little taste of what you can do, here is a small example on how to script Internet Explorer from Groovy:

import org.codehaus.groovy.scriptom.ActiveXProxy explorer = new ActiveXProxy("InternetExplorer.Application") explorer.Visible = true explorer.AddressBar = true explorer.Navigate("http://glaforge.free.fr/weblog")

You can even use the ScriptControl component to mix VBScript code and Groovy! A somewhat alien alliance, but Scriptom can be pretty useful ;-)

Enjoy!