Automation Lighting Rooms in Index.html

Forum for discussing building user interfaces for controlling MLServer using the iPhone or iPod Touch.
Clever1
Senior Member
Senior Member
Posts: 220
Joined: Mon Jan 14, 2008 10:31 am
Location: Huntsville, AL.
Contact:

Automation Lighting Rooms in Index.html

Postby Clever1 » Mon Aug 16, 2010 3:38 pm

Ok I have a script that queries all hai_001_unit variables looking for HLCRoom as the type and sets a server variable to those room names plus keeps count of how many rooms. Now how do I take these new variables I have created an dynamically make index.html by using them to label the rooms that are available for lighting control.

I figure this is the first step and then second step with be to update the script to capture all of the Loads' names as will and create the Lighting.html pages with those variables.

HAI Lighting Rooms Query Script:

Option Explicit

dim tmpStr1
dim tmpStr2
dim RoomCount

Sub SetQueryString

dim Unit
dim MaxHAIUnits
dim oShell
dim Username

Set oShell = CreateObject("WScript.Shell")
Username = oShell.ExpandEnvironmentStrings("%username%")
Set oShell = Nothing

MaxHAIUnits = 255

For Unit = 0 to MaxHAIUnits

If Unit < 10 Then
tmpStr1 = "hai_001_unit00" & Unit & "_type"
tmpStr2 = "hai_001_unit00" & Unit & "_name"
ElseIf Unit > 99 Then
tmpStr1 = "hai_001_unit" & Unit & "_type"
tmpStr2 = "hai_001_unit" & Unit & "_name"
Else
tmpStr1 = "hai_001_unit0" & Unit & "_type"
tmpStr2 = "hai_001_unit0" & Unit & "_name"
End If

Call ProcessUnit(Unit)

Next

MLServer.SetVariable "Lighting_Room_Count", RoomCount

End Sub

Sub ProcessUnit(Unit)

dim HAIRoom
dim UnitType
dim Count
dim tmpStr3

UnitType = MLServer.GetVariable (cStr(tmpStr1))
If UnitType = "HLCRoom" Then
HAIRoom = MLServer.GetVariable (cStr(tmpStr2))
RoomCount = RoomCount + 1
tmpStr3 = "Current Unit: " & Unit & " Current Unit Type: " & UnitType & " Current HAIRoom: " & HAIRoom & " Current Room Count: " & RoomCount
MLServer.LogMLEvent "HAI_Unit_Rooms_Script", cStr(tmpStr3)
tmpStr3 = "Lighting_Room" & RoomCount
MLServer.SetVariable cStr(tmpStr3), HAIRoom
End If
End Sub

Call SetQueryString

Return to “iPhone / iPod Touch Beta”

Who is online

Users browsing this forum: No registered users and 1 guest