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?
 
It looks like the object named:
Devices.X10.Item("Paul heat")

... does not support the Command property... or if it does, it is read-only or otherwise rejects the assignment of the value dsoff
 
Also can you post a link where we can learn more about the home automation thingy?
 
From the rest of your posted script I guess that dsoff is a State, not a Command.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I was assuming that "Command" was valid as the program author used it in an example:

Devices.Relays(“BR1Blinds”).Command=dcON
 
Maybe it is valid for the object named BR1Blinds but not for the object named Paul heat ???


 
The "BR1Blinds" or "Paul heat" are nothing more than a name given to a X10 Device. An example is that there are 256 available X10 devices with address from A-1 to A16 through P1-P16. Address A1 (X10 Device) is given the name "Paul heat" so regardless of the "name" the command function should work
 
And what about this ?
.Command=d[!]c[/!]off ' instead of dsoff

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That is correct. After reading more of the docs on the program the "ds" is Device State" and the "dc" is Devise Command. However, I had already changed that and got the following error message;

If .Item("Paul").Value > 69 Then
Devices.X10.Item("Paul heat").Command=dcoff <-- line 369

Error message: Script Error: Line 369 Object doesn't support this property or method: 'Devices.X10'
 
looking closely it seems like the code refers to this object as both Devices.X10Devices and also Devices.X10... are these perhaps the same object?
 
What is the difference between X10 and Relays ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
This automation software sounds seriously cool.

Please post a link to where it can be purchased.
 
They are both "devices" however the relays are a device on board the controller and a x10 device is external to the controller. An example of a x10 device is a "lamp module" where you plug the module into the wall and the lamp into the module. The controller sends commands to the module using the house wiring through a interface module plugged into the wall and the controller. Hope this helps explain the difference
 
It is when it works...LOL It just needs someone with a lot more knowledge than I to make it do all the cool stuff it can do. It has been a royal pain in my butt but at least forcing me to learn new things.
 
On line 160 there is an object named Devices.X10Devices

On line 369, an object is named Devices.X10 but is it the same object?
 
I tried using both X10devices.Item("paul heat").Command=dcoff and Devices.X10devices.Item("paul heat").Command=dcoff and still got the same error message:

Either
Script Error: Line 369 Object doesn't support this property or method: 'X10Devices.Item(...).Command'
or
Script Error: Line 369 Object doesn't support this property or method: 'Devices.X10Devices.Item(...).Command'
 
How about some debugging tests:
[tt]
If Devices.X10 Is Nothing Then
MsgBox "Devices.X10 Is Nothing"
Else
IF Devices.X10.Item("Paul heat") Is Nothing THEN
MsgBox "Devices.X10.Item("Paul heat") Is Nothing"
ELSE
MsgBox "Devices.X10.Item("Paul heat") Is Something"
END IF
End If

IF Devices.X10Devices Is Nothing THEN
MsgBox "Devices.X10Devices Is Nothing"
ELSE
IF Devices.X10Devices.Item("Paul heat") Is Nothing THEN
MsgBox "Devices.X10Devices.Item("Paul heat") Is Nothing"
ELSE
MsgBox "Devices.X10Devices.Item("Paul heat") Is Something"
END IF
END IF
[/tt]
 
I know this is most likely a stupid question but could it be that I am trying to use a "devices.x10devices"..." in the variable "sub" block? I wouldn't think it would matter but then again I am very green at VBS
 
It looks like it is being used on line 160 ... no error there?
 
Here is a C&P of the docs provided with the program, maybe this will help some.

The X10Devices collection also includes two additional commands.
X10Devices.Select(“Foo”)
X10Devices.Command(dcDevice Command)

This allows a selection of a device followed by multiple commands to that device.


Device Commands:

Device Command X10 Flag Variable Timer Digital Input Analog Input Relay Thermostat
dcOff = 0 X X N/A N/A N/A N/A X N/A
dcOn = 1 X X N/A N/A N/A N/A X N/A
dcIdle = 2 X X N/A N/A N/A N/A N/A N/A

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top