X10 Community Forum

🖥️ActiveHome Pro => SDK => Topic started by: marbobley on September 16, 2010, 12:07:59 PM

Title: i dont get "RecvAction" to work in ahscript.dll (autoit)
Post by: marbobley on September 16, 2010, 12:07:59 PM
here is my code:

Code: [Select]
Dim $temp = ""

HotKeySet("{F11}","_exit")

$rcdll = DllOpen("ahscript.dll")
If @error Then
    MsgBox(0,"error open dll",@error)
EndIf

Func _exit()
    Exit
EndFunc


While 1
    $temp = DllCall($rcdll,"str","RecvAction")
    If @error Then
        MsgBox(0,"error call recvaction",@error)
    EndIf
    If $temp = "" Then
    Else
        MsgBox(0,"",$temp)
    EndIf
WEnd


when i call the dll i get error "3"
what am i doing wrong?

never did this dll things :-/ if i got this the rest is easy going (control winamp,poker,vlc,...)

greetings, phil
Title: Re: i dont get "RecvAction" to work in ahscript.dll (autoit)
Post by: -Bill- (of wgjohns.com) on September 17, 2010, 12:28:33 AM
RecvAction is basically an event pump, like a WindowMessage.  I don't think it is possible to call it directly like that.  Granted, I've never attempted to access the ahscript.dll directly as you are doing in what?  Autoit?

I have used it in JScript with the X10 SDK.

As far as I know, what you need to do is create an event handler that handles the RecvAction event broadcast by the ahscript.dll.

I hope that is at least a little help.  Again, I'm not familiar with the particular tool(s) you're using or accessing the ahscript.dll directly like that.

 >!
Title: Re: i dont get "RecvAction" to work in ahscript.dll (autoit)
Post by: marbobley on September 17, 2010, 10:26:36 PM
i got it!


you were absolutely right i had to do it a very different way

for anyone who is interested in the code:

Code: [Select]
HotKeySet("{F11}","_exit")

$x10 = ObjCreate("X10.ActiveHome")
If @error Then
    MsgBox(0,"",@error)
EndIf

$x10event = ObjEvent($x10,"_x10event")

Func _x10event($parameter1,$parameter2,$parameter3,$parameter4,$parameter5,$parameter6,$parameter7)
    MsgBox(0,"",$parameter1 & @CRLF &  $parameter2 & "@CLF" &  $parameter3 & @CRLF &  $parameter4 & @CRLF &  $parameter5 & @CRLF &  $parameter6 & @CRLF &  $parameter7)
EndFunc

Func _exit()
    Exit
EndFunc

While 1
    Sleep(10)
WEnd
Title: Re: i dont get "RecvAction" to work in ahscript.dll (autoit)
Post by: -Bill- (of wgjohns.com) on September 17, 2010, 10:31:11 PM
Yeah!

That looks much more like how I got it to work in JScript.

Cool!   8)

Glad I could help!
 >!