Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object doesn't support this property or method: 1

Status
Not open for further replies.

storm69

Technical User
Jan 31, 2006
26
US
I am using a program that uses VB Scripts to run a Home Automation Controller. I am new to VB Scripts but trying real hard and fast to learn. I am getting this error "Object doesn't support this property or method:'Devices'. The Devices are defined in "Sub" blocks and I am trying to use a device that has already been defined in a previous sub block but will not recognize it in another. The first bit of code is where the devices are defined. The second is where I am trying to use it and get the error.

Rem **************************************************************
Rem Devices: Contains all devices within controller
Rem X10, Flags, Variables, Relays, AIs, DIs, etc.
Rem Unique event for each device type for ease of processing

Rem **************************************************************
Rem X10 Device Event
Rem **************************************************************
sub Devices_X10Update(Index) <--line 159
with Devices.X10Devices
Select Case .Item(Index).State
Case dsOff
REM Character.Speak .Item(Index).Name + " is off"
Case dsOn
REM Character.Speak .Item(Index).Name + " is on"
Case dsIdle
REM Character.Speak .Item(Index).Name + " is idle"
Case dsDisabled
REM Character.Speak .Item(Index).Name + " is disabled"
Case dsEnabled
REM Character.Speak .Item(Index).Name + " is enabled"
Case dsUnknown
REM Character.Speak .Item(Index).Name + " is unknown"
end Select
end with

end sub

Rem **************************************************************
Rem Variable Device Event
Rem **************************************************************
sub Devices_VariableUpdate(Index)
with Devices.Variables
REM Character.Speak .Item(Index).Name & " is now " & (.Item(Index).Value) & " degrees"
If .Item("Paul").Value > 69 Then
Devices.X10.Item("Paul heat").Command = dsoff <--- ERROR LINE

So what is it that I am obviously missing here?
 
Oh, well in that case maybe the syntax is wrong and one of these two would work better:
[tt]call Devices.X10Devices.Item("Paul heat").Command(dcOff)[/tt]

or simply:
[tt]Devices.X10Devices.Item("Paul heat").Command dcOff[/tt]


The original code looked like it was setting the value of a property named .Command to the value of dcOff ... rather than calling a method named Command that takes an argument value dcOff
 
Oh, another way to interpret that statement from the docs:[tt]X10Devices.Select("Paul heat")
X10Devices.Command(dcOff)[/tt]

 
Well, the "()" did the trick. Being very green at this please explain why the "()" had to be used. Here is the line of code that worked

Devices.X10Devices.Item("Paul heat").command(dcoff)

Sheco,
What is it exactly you would like to know about the HA (home automation), the hardware or the software?

 
Setting properties
LittleDog.Color = "Brown"
LittleDog.Ears = "cut short"
LittleDog.Tail = "cut long"

Calling methods (aka functions)
LittleDog.Bark(on)
LittleDog.Bite("Postal Worker")
LittleDog.Bark(off)
LittleDog.Run("Back Yard")
LittleDog.Poop()


I'm interested in both the hardware and the software... The first job I had out of college was writing sorftware to control factory robots and so I like tinkering with computer controlled automation. I should have never left that place... but the dotcom $$$ were too big of a draw. Oh well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top