[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua ActiveX Scripting engine
- From: "steve donovan" <steve.j.donovan@...>
- Date: Tue, 19 Aug 2008 11:55:56 +0200
> On 14/08/2008 16:32, Paul Moore wrote:
>> I'm sure I recall a long while ago, an ActiveX scripting engine for
>> Lua (basically, allowing Lua to be used in place of VBScript or
>> JScript on Windows). However, I can't seem to find it any more -
>> LuaCOM doesn't seem to include this, and I can't see anything else
>> which looks appropriate on the Lua wiki.
LuaCOM can access all the usual automation interfaces which WSH uses,
except for the basic WScript object. So one can really do all that a
typical WSH script can do anyway.
require 'luacom'
local sh = luacom.CreateObject('Wscript.Shell')
sh:Run('notepad',1,false)
sh:Run 'notepad' -- sensible defaults!
sh:Popup('A Message!')
> n = luacom.CreateObject('WScript.Network')
> = n
table: 008FFAA8
> = n.ComputerName
HPLAP
> = n.UserName
steve
> = n.UserDomain
HPLAP
Some things aren't entirely obvious from the documentation; Item is
described as a property but is called like function:
> env = w:Environment()
> = env:Item 'PATH'
....c:\lang\gcc\bin;C:\python25;c:\lang\lua;C:\Program Files\Lua\5.1;
C:\Program Files\Lua\5.1\clibs
> = env:Count()
19
steve d.