therealhanuta
Members-
Posts
17 -
Joined
-
Last visited
Recent Profile Visitors
429 profile views
therealhanuta's Achievements
Seeker (1/7)
6
Reputation
-
mLipok reacted to a post in a topic: CommAPI - Serial and parallel communication with Windows API
-
Moriba reacted to a post in a topic: CommAPI - Serial and parallel communication with Windows API
-
How to stop script when using debug windows
therealhanuta replied to Patchworks's topic in AutoIt General Help and Support
Hi Melba23, I have found a solution. It is not best, because it use AdlibRegister. But it works fine. #include <Debug.au3> _DebugSetup() AdlibRegister("Debug_ReportWindowWaitClose") For $i = 1 To 100 _DebugReport($i) Sleep(100) Next Func Debug_ReportWindowWaitClose() If Not $__gbReportWindowWaitClose_Debug Then Return 0 ; use of the already opened window so no need to wait Local $nOld = Opt("WinDetectHiddenText", True) Local $hWndReportWindow = WinGetHandle($__gsReportTitle_Debug, $__gsReportWindowText_Debug) Opt("WinDetectHiddenText", $nOld) $nOld = Opt('GUIOnEventMode', 0) ; save event mode in case user script was using event mode Local Const $GUI_EVENT_CLOSE = -3 Local $aMsg While WinExists(HWnd($hWndReportWindow)) $aMsg = GUIGetMsg(1) If Not $aMsg[0] Then ExitLoop If $aMsg[1] = $hWndReportWindow And $aMsg[0] = $GUI_EVENT_CLOSE Then GUIDelete($hWndReportWindow) Exit EndIf WEnd Opt('GUIOnEventMode', $nOld) ; restore event mode EndFunc -
stormbreaker reacted to a post in a topic: CommAPI - Serial and parallel communication with Windows API
-
Hi thoms, you are right. separator is no longer returned CommObsolete.au3 is created for backward compatibility
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Hi thoms, thanks for your solution. I have taken your approach and have made some changes. I have replaced ReceiveData & ReceiveLine with ReceiveBinary & ReceiveString. To read only one byte: _CommAPI_ReceiveByte($hFile, 1, 1) To read a line: _CommAPI_ReceiveString($hFile, 1, 0, @CRLF)
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Hi thoms, please try again with current CommInterface.au3 I have fixed some errors, now.
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Hi thoms, I can't find any error. For me COM10 is working fine. Are you using function _CommAPI_OpenPort or _CommAPI_OpenCOMPort? Func _CommAPI_OpenPort(Const $sMode) Local $sFileName = "\\.\" & StringLeft($sMode, StringInStr($sMode, ":") - 1) Local $hFile = _WinAPI_CreateFile($sFileName, 3, 6) Line 103 is responsible for COM ports greater than 9.
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Hi thoms, I fixed @error handling, but I can't help you to create an example, because I have never used this function. Maybe this can help you to create an examples for us: http://www.codeproject.com/Articles/2682/Serial-Communication-in-Windows (Search for WaitCommEvent)
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Hi adom, it is necessary only once.
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Hello Marcsf73, I have added a similar function, now. An example you can find here: http://www.autoitscript.com/wiki/CommAPI_Examples#Separator Hello adom, here you can find the changelog: http://www.autoitscript.com/wiki/CommAPI#Changelog
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Hi everybody! You can found this constant in file "C:\Program Files (x86)\AutoIt3\Include\FileConstants.au3". I thought that I could use it for Execute + Read + Write. But I have just realized that I was wrong. Now, I have changed this line to increase compatibility for all. Using of $iShare = 2 + 6 has now effect for serial communication. The modified line is therefore as follows: Local $hFile = _WinAPI_CreateFile($sFileName, 3, 6)
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Please, have a look into documentation: ; Name ..........: _CommAPI_ReceiveData ; Description ...: Receives data (RxD/RX/RD) to a specified communications device. ; Syntax ........: _CommAPI_ReceiveData(Const $hFile[, $iTimeout = 0]) ; Parameters ....: $hFile - [in] A handle to the communications device. ; $iTimeout - [in] An integer value for total read timeout in milliseconds. ; Return values .: Success - Received string ; Failure - Empty string ; Author ........: ; Modified ......: ; Remarks .......: If the result contains Chr(0), you should convert the result with function Binary(). Local Const $sToken = "<CR>" Local $sResult = "" Local $iPosition = 0 Do $sResult &= _CommAPI_ReceiveData($hFile) $iPosition = StringInStr($sResult, $sToken) If $iPosition > 0 Then MsgBox(0,0,StringLeft($sResult,$iPosition-1)) $sResult = StringMid($sResult,$iPosition+StringLen($sToken)) EndIf Until Not $sResult And $iPosition
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
adom reacted to a post in a topic: CommAPI - Serial and parallel communication with Windows API
-
adom reacted to a post in a topic: CommAPI - Serial and parallel communication with Windows API
-
Some new changes: Rename CommAPIStructures.au3 to CommAPIConstants.au3 Replace hex values with Constants
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
15 is sum of PURGE_TXABORT, PURGE_RXABORT, PURGE_TXCLEAR and PURGE_RXCLEAR. More details you can find here: http://msdn.microsoft.com/en-us/library/aa363428(v=vs.85).aspx 5000 means a max timeout of 5 seconds. I think you are using an old version. One month ago I changed timeout handling. You have to use build in String functions like StringRegExp or StringInStr.
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Hi sulfurious, there are 3 useful tools.that I use: command MODE in command line (it shows you the current settings of COM ports) HTerm as a better HyperTerminal (German developer site, but English GUI) Null-modem emulator com0com (virtual serial port driver for test purposes) First, try following steps: run MODE run HyperTerminal run MODE again compare both results if there is a different, this is the solution If there is no different, try application HTerm. Play with options "CTS Flow control", DTR and RTS.
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
Here you can find some examples, now.
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with:
-
No, you have to close port before you can use _CommAPI_OpenCOMPort again. Instead of this you can use function _CommAPI_ChangeCommStateElement. Or you can use _CommAPI_BuildCommDCB in combination with _CommAPI_SetCommState. No, because I use only DLL calls and no COM object. You habe to check @error after every function. I would expect, that @error is set when you try to transmit or receive data. Unfortunately I habe no USB-to-serial converter to test this.
- 116 replies
-
- COM portserial port
- RS-232
-
(and 4 more)
Tagged with: