toasterking

Possible COM bug in AutoIt

2 posts in this topic

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 3.3.6.1, 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 3.3.8.0 and later (including the latest beta 3.3.9.4), 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 3.3.8.0 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")
Sleep(2000)
ConsoleWrite("No echo received. The interface is not working." & @CRLF)
Exit

; 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)
Exit
EndFunc

If I run this with AutoIt 3.3.6.1, I get:

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

If I run this with AutoIt 3.3.8.0, 3.3.8.1, or 3.3.9.4 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 3.3.6.1 was always the string "RecvAction". I found that if I rename my function to _X10RecvEventRecvAction, it works in 3.3.8.0 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