Jump to content
Sign in to follow this  

Possible COM bug in AutoIt

Recommended Posts

I think I have found a bug but am not sure whether to file a bug report.

I have several scripts that use the ActiveHome SDK from X10 to send and receive X10 powerline commands using an X10 CM15A computer interface. With AutoIt, I am able to create the COM object and send and receive events with no problem and I have been using it this way for years. With AutoIt and later (including the latest beta, I can create the COM object without errors and am able to send events but not receive. I honestly don't know whether the bug is in the ActiveHome SDK or in AutoIt, but I noticed that many changes were made to COM support in AutoIt so I'm thinking that one of them may have broken COM compatibility with this particular software.

Here is some test code:

$oX10api = ObjCreate("X10.ActiveHome")
If @error Then MsgBox(0,@ScriptName,"ObjCreate error: " & @error)
$hX10Event = ObjEvent($oX10api,"_X10RecvEvent")
If @error Then MsgBox(0,@ScriptName,"ObjEvent error: " & @error)

$oX10api.SendAction("sendplc", "d1 on")
ConsoleWrite("No echo received. The interface is not working." & @CRLF)

; This function is called when data is received via X10.
Func _X10RecvEvent($sParam1,$sParam2,$sParam3,$sParam4,$sParam5,$sParam6,$sParam7)
ConsoleWrite("Data received: " & $sParam1 & " " & $sParam2 & " " & $sParam3 & " " & $sParam4 & " " & $sParam5 & " " & $sParam6 & " " & $sParam7 & @CRLF & _
"The interface is working." & @CRLF)

If I run this with AutoIt, I get:

Data received: RecvAction RecvPlc d1 On
The interface is working.

If I run this with AutoIt,, or beta, I get:

No echo received. The interface is not working.

Unfortunately, this test code requires both the ActiveHome SDK and the CM15A computer interface hardware (Wiki, Kit) to work.

Share this post

Link to post
Share on other sites

Apparently, the bug was me! The first parameter that got passed to my function _X10RecvEvent() in was always the string "RecvAction". I found that if I rename my function to _X10RecvEventRecvAction, it works in although the first parameter is omitted when the function is called.

Either this was an undocumented script-breaking change or I am misunderstanding the intended use of ObjEvent() and my code was never intended to work in the first place. It would be great if someone more knowledgeable could confirm which of these seems to be the case. :-) I see that there is one documented script-breaking change regarding ObjEvent(), ObjName(), and COM method syntax, but they do not seem to apply to my scenario.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...