Jump to content

adnadeau

Members
  • Posts

    5
  • Joined

  • Last visited

adnadeau's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. Thanks for this. I've been using a Roku Remote au3 script that I downloaded from a Roku forum to control various streaming devices from a Windows 7 laptop. However, it won't work on my Windows 11 laptop. Stranglely enough, the compiled version still works with Windows 7, but the au3 version doesn't work anymore. Your script works fine my Windows 7 machine; I haven't tried it yet on Win 11. Here's where I got the original script: http://forums.roku.com/viewtopic.php?p=353412&sid=b2b387c6f19e31cb1f8208a6cbf4bbfb but it's gone. I attached the almost original au3 script. rokuRemote(v2.0).au3
  2. I rewrote your function as a stand-alone script. It works okay. #include <CommMG64.au3> $Result = _SendAndRead(0x12345678, 4, 1) MsgBox(0x0, "$iRet", "Result = " & $Result) Func _SendAndRead($data, $numBytesToRead, $readType = 1) Local $Initialized $bBinData = Binary($data) ConsoleWrite("Line " & @ScriptLineNumber & ": $bBinData = " & $bBinData & @CRLF) $iNumbytes = BinaryLen($bBinData) ConsoleWrite("Line " & @ScriptLineNumber & ": $iNumbytes = " & $iNumbytes & @CRLF) $tBinData = DllStructCreate("byte["&$iNumbytes&"]") ;ConsoleWrite("Line " & @ScriptLineNumber & ": $tBinData = " & $tBinData & @CRLF) DllStructSetData($tBinData, 1, $bBinData) $iRet = _CommSendByteArray(DllStructGetPtr($tBinData),$iNumbytes,1) If (@error Or $iRet = -1) And $Initialized = 1 Then MsgBox(0x0, "Error while sending", "!Error: " & @error, 1) $iRet = _CommReadByteArray(DllStructGetPtr($tBinData),$numBytesToRead,$readType) If (@error Or $iRet = -1) And $Initialized = 1 Then MsgBox(0x0, "Error while reading", "!Error: " & @error, 1) ;Finalize() EndIf $iRet = DllStructGetData($tBinData, 1) Return $iRet EndFunc Regards, Alan
  3. Your last $iRet, as you noted, returns the number of bytes read. After that, you need to get the received data from the buffer. Add another line such as: $iRet = DllStructGetData($tBinData, 1) I hope that works; I'm kinda sketchy on structs, myself. Alan
  4. Hi Martin, Thanks for taking the time to redo your ,dll to 64 bit. I've been switching over some of my scripts with mostly some success. Here's what I have so far. Here's what works so far in my scripts in 64 bit mode: _CommGetVersion(1) _CommSendString() _CommGetInputCount() _CommReadByteArray() _CommSetPort() _CommClosePort() _CommListPorts(0) Here's what doesn't work: _CommGetString() I haven't tried any other functions. Your .zip file contains Commg64Example.exe; not the .au3 version. I just got garbage with your .exe. I took your original 32 bit Commg.au3 & changed it over, but it still returned garbage. I tried another of my scripts which use _CommGetString() with same results. I'm using a 64 bit laptop, Windows 7, & testing the scripts as .au3s Alan
  5. Martin, Thank you very much indeed for your serial comms dll and your dedication to maintaining it. I discovered it and AutoIT about a year ago. I've been using it to retrieve data from my Davis weather station, using a pair of XBees for the serial link. I used your example com script to learn AutoIT by commenting each line with info from the Help file. I ended up using the example as the starting point for my script to get & display my weather data. Recently, I've been using another pair of XBees to get data from a thermocouple-to-mV converter. The XBees have a number of analog & digital inputs & outputs in addition to D-in and D-out. In this mode, all communication through the serial port must be in hex packets or frames, as defined by the ZigBee protocol. The frame delimiter is hex 7E; there are no carriage returns or line feeds, the frame length is variable--about 21 bytes--and the frame does contain nulls. After several false starts, I ended up using _CommReadByte in a While loop looking for the 7E start byte. The next 2 bytes are the frame length, so I used that to create a struct and use _CommReadByteArray to get the rest of the frame. I again used your example script as the underlying structure. Trying to figure out when a function return was a decimal or hex, and if hex, did it have a 0x prefix, was a continuing problem. By the way, why not just advise your 64-bit readers to just put #AutoIt3Wrapper_UseX64=n as the first line of any script using your dll; took me a while to figure that out, too, 'cause I was running my scripts without compiling them first. I'm surprised I don't see any mention of XBees in your thread. They're great for cutting the serial cable and going wireless. There are a bunch of adapters for them for USB ports and Arduinos, etc. available through the experimenter web sites. Seems like most of the scripts for them are in Java or Processing. I haven't run across anyone else using AutoIT. Alan
×
×
  • Create New...