Hello Dierk,
Hey, that's a pretty nice example :-)
If we have more and more intersting samples, we should even start a
dedicated page of samples on Confluence!
This example is particularly interesting for doing some automated monkey
testing with Groovy :-)
Guillaume
Dierk Koenig wrote:
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