Is it possible to use a second file in a vb.net script to call a common subroutine? For instance, the blow could be cut into 2 scripts
And have it call the script below from a second file
So that I can use the second part in other scripts as well. I will have at least 6 scripts using this same subroutine.
Karl
Code:
Sub Main(Parms As Object) ' hs.writelog("Parameter Test",CInt(Parms(0))) Dim newValue as Integer newValue = CInt(Parms(0)) 'Ceiling Fan TestSet("Ceiling Fan Light Selector", "Ceiling Fan Light", newValue) 'Fireplace Outside Cans TestSet("HSTouch -Fireplace Outside Cans Selector", "Fireplace Outside Lights", newValue) 'Fireplace Inside Cans TestSet("Fireplace Inside Lights", "HSTouch -Fireplace Inside Cans Selector", newValue) 'Entrance Light TestSet("Entrance Light @ Door", "HSTouch - Foyer Selector", newValue) 'Light Outside Powder Room TestSet("Light Outside Powder Room", "HSTouch - Light Outside Powder Room Selector", newValue) 'Stairs Light TestSet("HSTouch - Stairs Light Selector","Main Stairs Lights @ Top of Steps", newValue) End Sub
Code:
Sub TestSet(byRef Selector as String, byRef Device as String, byRef , newValue as Integer) Dim SelectorRef As Integer Dim DevRef As Integer 'Get the Device References SelectorRef = hs.GetDeviceRefByName(Selector) DevRef = hs.GetDeviceRefByName(Device) 'Set the Device Value if the Device Selector is selected. If hs.IsOn (SelectorRef) then hs.CAPIControlHandler(hs.CAPIGetSingleControl(DevRef,false,newValue,false,true)) end if End Sub
Karl
Comment