Airfoil for Windows WScript port
Wondered if anyone had a clear idea of how to port WScript or CScript commands into Lua. I'm looking at this:
And i'm trying to port the object to something like luacom.CreateObject("RogueAmoeba.Airfoil"); but to be honest I'd never heard of Lua before playing with these remotes!! I can get a remote firing up the Airfoil app by reworking some of the Chrome app commands but whenever I try to access a function I get basic indexing errors.
Not looking for a massively prescriptive answer, just the initial hook to build out from.
Any help massively appreciated!!
Could you please share the remote you have built so far? The thing that is a bit strange with lua is that it is 1 indext and not 0 as most languages that might be the issue you are having.
Hi, thanks for responding - that it's indexed on 1 will be very useful to know!! However I suspect I'm not even getting that far - here's the code I've cobbled together so far. I started with the Chrome example but moved to the iTunes example as that returned the application as an object which the Airfiol WScript example looks like it needs. I've also commented out the timer lines as they also returned an error. Any ideas really appreciated.
LuaInstance: could not run action:
error: ...ramData\Unified Remote\Remotes\Custom\Airfoil\remote.lua:36: attempt to index local 'getspeakers' (a function value)
local timer = libs.timer; local server = libs.server; local tid_update = -1; local obj = nil; events.detect = function () return libs.fs.exists("C:\\Program Files (x86)\\Airfoil") or libs.fs.exists("C:\\Program Files\\Airfoil"); end [email protected] Launch Airfoil application actions.launch = function() os.start("airfoil"); end events.focus = function () obj = luacom.CreateObject("RogueAmoeba.Airfoil"); --tid_update = timer.timeout(update, 1000); end events.blur = function () --timer.cancel(tid_update); obj = nil; collectgarbage(); end function valid() return (obj ~= nil); end [email protected] Test action actions.test = function () if (valid()) then local getspeakers = obj.GetSpeakers; local speakercount = getspeakers.Count; print(speakercount); end end```