Thursday, November 2, 2006

First attempt at integrating HALi & starCOM

I recently found out that in HAL, I cannot pass variable names as arguments to launching a program. Yet more limitations! To get around this, I'm calling HALi from sC:


// instantiate hali object
var HAL = new ActiveXObject("HALiContol.HAli");
while(HAL.Init()==false) {
Timer.DoSleep(500);
}


Then when I need to launch something, I have HAL execute a VBScript calling sC and setting a flag. Then sC goes in a grabs the info it needs:


function Devices::FlagUpdate(Index) {
with (Devices.Flags) {
case dsOn:
if (Item(Index).Name=="HALFlag") {
HALZone = HAL.Sensors.ItemByName("ZONE").State;
HALPlaylist = HAL.Sensors.ItemByName("PLAYLIST").State;
Devices.Flags.Item("HALFlag").State=0;
ShellCmd.Run("perl medianet.pl " + HALZone + " " + HALPlaylist);
}

...

No comments:

Post a Comment