Expect-lua for Windows
sendvkey(VIRTUAL_KEYCODE)
. (Thanks to @chrisdonlan)
local pid = spawn("cmd.exe")
if not pid then
os.exit(1)
end
send("rem exit")
sleep(1)
sendvkey(0x24) -- HOME
sendvkey(0x2E) -- DELETE
sendvkey(0x2E) -- DELETE
sendvkey(0x2E) -- DELETE
sendvkey(0x2E) -- DELETE
sendln("")
wait(pid)
local OBJ=create_object()
creates OLE-ObjectOBJ:method(...)
calls methodOBJ:_get("PROPERTY")
returns the value of the property.OBJ:_set("PROPERTY",value)
sets the value to the property.OBJ:_iter()
returns an enumerator of the collection.OBJ:_release()
releases the COM-instance.local N=to_ole_integer(10)
creates the integer value for OLE.capturelines
(default:2)
expect()
is executed.sleep(SECOND)
, usleep(MICROSECOND)
capturelines
を追加(デフォルトは2)
expect()
が実行されたときにキャプチャーする行数を指定します。sleep(秒)
と usleep(マイクロ秒)
を追加shot(N)
shot(N)
is the function to capture the N lines of the screen.
local screen = assert(shot(25))
for i = 1,#screen do
print( i,screen[i] )
end
shot(N)
を追加しました。shot(N)
は画面の N 行をキャプチャーする関数です。
ESC[49m
instead of black ESC[40m
-nologo
option_MATCHPOSITION
, _MATCHLINE
, _MATCH
, _PREMATCH
, and _POSTMATCH
. (Thanks to @rdrdrdrd95 )ESC[40m
のかわりに、デフォルトの背景色 ESC[49m
を使うようにした-nologo
オプションを追加_MATCHPOSITION
, _MATCHLINE
, _MATCH
, _PREMATCH
, _POSTMATCH
.にセットするようにした。wait(PID)
that waits the process of PID terminates.Sample :
local pid = assert(spawn("notepad"))
echo("wait ".. pid)
assert(wait(pid))
echo("done ".. pid)
spawnctx
is the similar one with spawn
, but the process started by spawnctx is killed when Ctrl-C is pressed.spawnctx
は spawn
と似ているが、起動されたプロセスは Ctrl-C が押された時に自動的に kill される