Jump to content

Recommended Posts

Yes, they are usb virtual com ports.

I'm not sure how your DLL works. In netcomm ocx I did this. Basically if the port gets disconnected i just want to turn off the gps. i don't need it to work again automatically when the gps gets plugged back in. I havent gotten any bsods when unplugging the gps, the program just crashes

If $NetComm.InBufferCount Then
            $Buffer = $NetComm.InBufferCount
            If $Buffer > 100 And $LatTest = 0 And TimerDiff($timeout) < $maxtime Then
                $inputdata = $NetComm.inputdata
                $gps = StringSplit($inputdata, "$")
                For $readloop = 1 To $gps[0]
                    If StringInStr($gps[$readloop], "GPGGA") Then
                        _GetGpsData($gps[$readloop])
                        If $LatTest = 1 Then ExitLoop
                        If TimerDiff($timeout) > $maxtime Then ExitLoop
                    EndIf
                Next
                If $LatTest = 1 Then
                    $refresh_gps = TimerInit()
                    ExitLoop
                EndIf
            EndIf

            If TimerDiff($timeout) > $maxtime Then
                GUICtrlSetData($msgdisplay, 'GPS Timeout')
                ExitLoop
            EndIf
            Sleep($maxtime / 100)
            $disconnected_time = TimerInit() ;reset gps turn off timer
        Else
            If $disconnected_time = -1 Then $disconnected_time = TimerInit()
            If TimerDiff($disconnected_time) > 10000 Then ; If nothing has been found in the buffer for 5 seconds, turn off gps
                $disconnected_time = -1
                $return = 0
                _GpsToggle()
                SoundPlay($SoundDir & $error_sound, 0)
            EndIf
        EndIf

I am expecting (hoping) that I will be able to prevent a crash by improving the error checking, but I need to dedicate a couple of hours to it and I haven't been able to do that yet.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Any progress on the error handling?

I'm ashamed to say that there isn't any. I tried for a short time but didn't manage to improve it. Since it wasn't something that was stopping anyone using it I put it to one side for a while, and that's where it's stayed.

I doubt I'll get back to it until February, so give me another kick in a month if I haven't posted an update.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

newbie here!!

I wanna create a loop to send a command to serial port

receive the result

wait

and after nth time end the program

How can i do that??

thanks in advance

Share this post


Link to post
Share on other sites

newbie here!!

I wanna create a loop to send a command to serial port

receive the result

wait

and after nth time end the program

How can i do that??

thanks in advance

Welcome to the forums :D

I see that my down load for the latest version doesn't have the example with it, so I have added this as an extra attachment in the first post. It should work with the latest version of AutoIt.

Try the running the example and then if you have questions come back again.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Welcome to the forums :D

I see that my down load for the latest version doesn't have the example with it, so I have added this as an extra attachment in the first post. It should work with the latest version of AutoIt.

Try the running the example and then if you have questions come back again.

Hi martin. Here is a newbie too. First congratulations for your Serial Port UDF.

I had already looked at the Serial Port UDF but i couldn't make it work even becouse i'm a newbie, but now that you post an example i can get start...

One question, in your example you put:

#include <CommMG.au3>;or if you save the commMg.dll in the @scripdir use #include @SciptDir & '\commmg.dll'

Do i need to put the CommMG.au3 with the other autoit3 functions? And the commMg.dll, could i put in the /windows directory so i don't need to use the #include @SciptDir & '\commmg.dll' ?

Thanks.

Bruno

Share this post


Link to post
Share on other sites

Hi martin. Here is a newbie too. First congratulations for your Serial Port UDF.

I had already looked at the Serial Port UDF but i couldn't make it work even becouse i'm a newbie, but now that you post an example i can get start...

One question, in your example you put:

#include <CommMG.au3>;or if you save the commMg.dll in the @scripdir use #include @SciptDir & '\commmg.dll'

Do i need to put the CommMG.au3 with the other autoit3 functions? And the commMg.dll, could i put in the /windows directory so i don't need to use the #include @SciptDir & '\commmg.dll' ?

Thanks.

Bruno

You're right, I did say that but it's a mistake. When I've finished this reply I will correct it. What I meant to say was

#include <CommMG.au3>;or if you save the commMg.AU3 in the @scripdir use #include @SciptDir & '\commmg.AU3'

; or just #include 'commg.au3'

Now that you've made me think of it, I will also add

; the dll (commg.dll) must be in either the script directory or the Windows directory.

My apologies for the error.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

You're right, I did say that but it's a mistake. When I've finished this reply I will correct it. What I meant to say was

#include <CommMG.au3>;or if you save the commMg.AU3 in the @scripdir use #include @SciptDir & '\commmg.AU3'

; or just #include 'commg.au3'

Now that you've made me think of it, I will also add

; the dll (commg.dll) must be in either the script directory or the Windows directory.

My apologies for the error.

Martin now it´s ok... :D

Now i can start to play with the Serial port...

Thanks Martin...

Bruno

Share this post


Link to post
Share on other sites

It's me again...

Martin, i'm trying to send Hex values thoght your UDF...

I'm using your example, but the hex values isn't working...

CODE
Func SendEvent();send the text in the inputand append CR

$msg = InputBox("Numero de bytes","Digite o numero de bytes que serao enviados")

$msg = Hex($msg,1)

_CommSendstring($msg);& GUICtrlRead($Input1))

GUICtrlSetData($Input1,'');clear the input

GUICtrlSetState($edit1,$GUI_FOCUS);sets the caret back in the terminal screen

EndFunc

I change your SendEvent() function for convert the $msg to hex but if i type 0 on the serial port it appers 0x0C.

Any tip???

Thanks.

Bruno

Share this post


Link to post
Share on other sites

It's me again...

Martin, i'm trying to send Hex values thoght your UDF...

I'm using your example, but the hex values isn't working...

CODE
Func SendEvent();send the text in the inputand append CR

$msg = InputBox("Numero de bytes","Digite o numero de bytes que serao enviados")

$msg = Hex($msg,1)

_CommSendstring($msg);& GUICtrlRead($Input1))

GUICtrlSetData($Input1,'');clear the input

GUICtrlSetState($edit1,$GUI_FOCUS);sets the caret back in the terminal screen

EndFunc

I change your SendEvent() function for convert the $msg to hex but if i type 0 on the serial port it appers 0x0C.

Any tip???

Thanks.

Bruno

I don't understand that at the moment.

When you say "it appears" where does it appear? Is it on the device you are sending the data to?

What is the reason for sending Hex(value,1)? Hex(0,1) is '0' so you are just sending the character '0'.

If you use the example script does the text get sent as expected?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I don't understand that at the moment.

When you say "it appears" where does it appear? Is it on the device you are sending the data to?

What is the reason for sending Hex(value,1)? Hex(0,1) is '0' so you are just sending the character '0'.

If you use the example script does the text get sent as expected?

It appers on the serial output, i´m using an osciloscpe to see it.

I´m want to send hex values becouse if you type '0' and send in your example it will appers on the serial output the 0x30 (ASCII value for 0) and @CR (i don´t remember the ASCII representation). So in the code that i posted i used the hex() to convert the value to hexadecimal but it didn´t output the right value, in this one sending '0' it sends 0x0C.

If you use the example script does the text get sent as expected?

It´s sented, but in the ASCII representation and i´m trying to change it and send hex or decimal values as it is written.

I hope you understend my explanation.

Thanks.

Bruno

Share this post


Link to post
Share on other sites

thanks for this udf. wish it could be blend in into the next version of autoit with parralel port udf.

great work.

Share this post


Link to post
Share on other sites

How about this Bruno, instead of using Hex use the Chr command.

Func SendEvent();send the text in the inputand append CR

$msg = InputBox("Numero de bytes","Digite o numero de bytes que serao enviados")

$msg = CHR($msg)

_CommSendstring($msg);& GUICtrlRead($Input1))

GUICtrlSetData($Input1,'');clear the input

GUICtrlSetState($edit1,$GUI_FOCUS);sets the caret back in the terminal screen

EndFunc

Am Also a fan of this UDF.

Share this post


Link to post
Share on other sites

How about this Bruno, instead of using Hex use the Chr command.

Func SendEvent();send the text in the inputand append CR

$msg = InputBox("Numero de bytes","Digite o numero de bytes que serao enviados")

$msg = CHR($msg)

_CommSendstring($msg);& GUICtrlRead($Input1))

GUICtrlSetData($Input1,'');clear the input

GUICtrlSetState($edit1,$GUI_FOCUS);sets the caret back in the terminal screen

EndFunc

Am Also a fan of this UDF.

Hi Smooth.

But this way will be the same.

If you type '0' it will send 0x30 or 48. I mean that i want to send 0x00.

Don't worry, i take other way to solve the problem.

Thanks.

Bruno

Share this post


Link to post
Share on other sites

It appers on the serial output, i´m using an osciloscpe to see it.

I´m want to send hex values becouse if you type '0' and send in your example it will appers on the serial output the 0x30 (ASCII value for 0) and @CR (i don´t remember the ASCII representation). So in the code that i posted i used the hex() to convert the value to hexadecimal but it didn´t output the right value, in this one sending '0' it sends 0x0C.

If you use the example script does the text get sent as expected?

It´s sented, but in the ASCII representation and i´m trying to change it and send hex or decimal values as it is written.

I hope you understend my explanation.

Thanks.

Bruno

If you want to send the binary value, ie a byte, then use _CommSendByte($val) where $val is 0 minimum, 255 maximum.

eg in your example use

_CommSendByte(0)

See also _CommReadByte.

You cannot send a byte of value zero using the string functions because a byte of zero is used to indicate the end of a string. That is one the reason I developed the UDF, many other utilities can make sending binary data difficult.

If you need to deal with a lot of binary data then the functions

_CommSendByteArray and _CommReadByteArray

could be useful. To use these you need to deal with DllStucts.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

thanks for this udf. wish it could be blend in into the next version of autoit with parralel port udf.

great work.

I'm pleased to help icadea.

I've learned a bit since writing this udf and if I started again it would be different of course, but, even if it were written very much better, it's not the sort of thing that should to be included with AutoIt IMO. Those who want it can get it, but most have no need for it.

I have no plans to develop a parallel port udf, but I think you'll find examples in the forums. I think I've read about someone operating relays from a parallel port and something about a remote door control.(Vague memories.)

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

If you want to send the binary value, ie a byte, then use _CommSendByte($val) where $val is 0 minimum, 255 maximum.

eg in your example use

_CommSendByte(0)

See also _CommReadByte.

You cannot send a byte of value zero using the string functions because a byte of zero is used to indicate the end of a string. That is one the reason I developed the UDF, many other utilities can make sending binary data difficult.

If you need to deal with a lot of binary data then the functions

_CommSendByteArray and _CommReadByteArray

could be useful. To use these you need to deal with DllStucts.

Thanks Martin, was this function that i'm looking for....

Bruno....

Share this post


Link to post
Share on other sites

Hi martin...

Now i'm working on the bytes functions of you UDF...

I don't know what is happen, if i'm doing something wrong or is the function...

dim $recbuf[3], $i
    _CommSendByte(255)  
    _CommSendByte(2)    
    _CommSendByte(254)  
    _CommSendByte(52)   
    For $i = 0 To 2
        $recbuf[$i] = _CommReadByte(0)          
    Next
    ;$recbuf = _CommReadByteArray(1,3,0)  ; le os 3 bytes
    If @error <> 0 Or  $recbuf[0] = -1 Then
        MsgBox(0, 'Resultado', 'Erro')
    Else
        MsgBox(0, 'Resultado', 'Ok')
        $received = _ArrayToString ($recbuf," ")    
        ;MsgBox(0, 'Resultado', $re)
        GUICtrlSetData ($valor,$received)   
    EndIf

The problem is that only in second time that this run that the _CommReadByte works, on the first time that this code run it gets @erros = 1 and run the MsgBox(0, 'Resultado', 'Erro') and the second, third... it runs ok...

My mistake??

Thanks.

Bruno

Share this post


Link to post
Share on other sites

Hi martin...

Now i'm working on the bytes functions of you UDF...

I don't know what is happen, if i'm doing something wrong or is the function...

dim $recbuf[3], $i
    _CommSendByte(255)  
    _CommSendByte(2)    
    _CommSendByte(254)  
    _CommSendByte(52)   
    For $i = 0 To 2
        $recbuf[$i] = _CommReadByte(0)          
    Next
    ;$recbuf = _CommReadByteArray(1,3,0)  ; le os 3 bytes
    If @error <> 0 Or  $recbuf[0] = -1 Then
        MsgBox(0, 'Resultado', 'Erro')
    Else
        MsgBox(0, 'Resultado', 'Ok')
        $received = _ArrayToString ($recbuf," ")    
        ;MsgBox(0, 'Resultado', $re)
        GUICtrlSetData ($valor,$received)   
    EndIf

The problem is that only in second time that this run that the _CommReadByte works, on the first time that this code run it gets @erros = 1 and run the MsgBox(0, 'Resultado', 'Erro') and the second, third... it runs ok...

My mistake??

Thanks.

Bruno

I don't know what the probelm is. You should check for errors immediately after calling the function, and _CommReadByte returns a string representation of the byte.

Can you try the code below and let me know what happens.

;assuming port set corectly at this stage
Dim $recbuf[3], $i
Global $Result = ''
_CommSendByteCheck(255)
_CommSendByteCheck(2)
_CommSendByteCheck(254)
_CommSendByteCheck(52)
For $i = 0 To 2
    If _CommGetInputCount() = '0' Then
        Sleep(300)
        If _CommGetInputCount() = '0' Then
            MsgBox(0, 'ERROR ', 'No data after 300mS')
            Exit
        EndIf
    Else   ;either an error or data available
        If @error = 1 Then
            MsgBox(0, 'Error', 'Failed to call _CommGetInputCount')
            Exit
        EndIf
    EndIf
    
;no error, data is available
    $Result &= _CommReadByte(0)
    Switch @error
        Case 1
            MsgBox(0, 'Error 1', 'No data to read, but data should be available.')
            Exit
        Case 2
            MsgBox(0, 'Error 2', 'Could not call function _CommReadByte.')
            Exit
    EndSwitch

    If $i < 2 Then $Result &= ', '
    
Next

MsgBox(0, 'Resultado', $Result)

Func _CommSendByteCheck($val)
    AdlibEnable("toolong", 2000)
;Will wait till byte sent. Could hang if problem so Adlib rescues
    If _CommSendByte($val, 1) = -1 Then
        MsgBox(0'Error', 'Could not send byte val ' & $val)
        Exit
    EndIf
    AdlibDisable()
EndFunc  ;==>_CommSendByteCheck

Func Toolong()
    AdlibDisable()
    MsgBox(0, 'ERROR', 'Could not send byte within 2 Seconds!')
    Exit
EndFunc  ;==>Toolong

martin


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

I don't know what the probelm is. You should check for errors immediately after calling the function, and _CommReadByte returns a string representation of the byte.

Can you try the code below and let me know what happens.

;assuming port set corectly at this stage
Dim $recbuf[3], $i
Global $Result = ''
_CommSendByteCheck(255)
_CommSendByteCheck(2)
_CommSendByteCheck(254)
_CommSendByteCheck(52)
For $i = 0 To 2
    If _CommGetInputCount() = '0' Then
        Sleep(300)
        If _CommGetInputCount() = '0' Then
            MsgBox(0, 'ERROR ', 'No data after 300mS')
            Exit
        EndIf
    Else  ;either an error or data available
        If @error = 1 Then
            MsgBox(0, 'Error', 'Failed to call _CommGetInputCount')
            Exit
        EndIf
    EndIf
    
;no error, data is available
    $Result &= _CommReadByte(0)
    Switch @error
        Case 1
            MsgBox(0, 'Error 1', 'No data to read, but data should be available.')
            Exit
        Case 2
            MsgBox(0, 'Error 2', 'Could not call function _CommReadByte.')
            Exit
    EndSwitch

    If $i < 2 Then $Result &= ', '
    
Next

MsgBox(0, 'Resultado', $Result)

Func _CommSendByteCheck($val)
    AdlibEnable("toolong", 2000)
;Will wait till byte sent. Could hang if problem so Adlib rescues
    If _CommSendByte($val, 1) = -1 Then
        MsgBox(0'Error', 'Could not send byte val ' & $val)
        Exit
    EndIf
    AdlibDisable()
EndFunc ;==>_CommSendByteCheck

Func Toolong()
    AdlibDisable()
    MsgBox(0, 'ERROR', 'Could not send byte within 2 Seconds!')
    Exit
EndFunc ;==>Toolong

martin

Martin, i will try it... Now i'm traveling... But when i came back i will make some tests and let you now...

Thanks..

Bruno

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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Corleone221
      Hello All,
       
      How can I load  actual connect  Com Ports to combobox?
       
      Thanks.
       
      for example  this 3....(6,7,8)

       
       
    • By cheeroke
      Hi all,
      I got this code and would like to be able to change Baud Rate and instead of sending character by character i would like to be able (if possible) to send whole string. But i don't know how to change it.
      I am taking input from file and processing whole line (this is done in FilesHandling.au3).
      To execute this i am just calling SendData("FileName", int) in "main" script.
      Any help very appreciated.
      #include <WinAPI.au3> #include <Array.au3> #include "FilesHandling.au3" ;init DLL function, we need handle to call the function $h = DllCall("Kernel32.dll", "hwnd", "CreateFile", "str", "\\.\COM19", "int", BitOR($GENERIC_READ,$GENERIC_WRITE), "int", 0, "ptr", 0, "int", $OPEN_EXISTING, "int", $FILE_ATTRIBUTE_NORMAL, "int", 0) $handle=$h[0] Func SendData($FileName, $LineNumber) ;string to be send $c = readFile($FileName, $LineNumber) $cLenght = StringLen($c) $aArray = StringSplit($c, "") ;_ArrayDisplay($aArray, "", Default, 64) For $i = 1 To $cLenght writeChar($handle, $aArray[$i], $cLenght) Next ;move to next line writeChar($handle, @CR,1) EndFunc ;write a single char func writeChar($handle,$c,) $stString = DLLStructCreate("char str") $lpNumberOfBytesWritten = 0 DllStructSetData($stString, 1, $c) $res = _WinAPI_WriteFile($handle, DllStructGetPtr($stString, "str"), 1,$lpNumberOfBytesWritten) if ($res<>true) then ConsoleWrite ( _WinAPI_GetLastErrorMessage() & @LF) EndIf EndFunc  
    • By SAM1386
      Hello,
      I can easily find my modem comport number using the code below:-
       
      #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3>    Global $key = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM","\Device\ssudmdm0000")     Local $iError = 0     If @error Then        ; The server is probably offline/port is not opened on the server.        $iError = @error         MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Client:" & @CRLF & "Could not connect, Error code: " & $iError)         Else         MsgBox($MB_ SYSTEMMODAL, "MODEM:", $key)         EndIf  
      but the thing is I am planning to design a small tool by which it can read the modem COM port and set the COM number and send AT command to modem port using UDF CommMG.au3 created by Martin. I added some below code to martins file :-
      ;====================================================================================================================== ;CommSendStandard,a new function for sending information to a serial port. ;====================================================================================================================== Func _CommSendStandard($port,$error,$command)    _CommSetPort($port,$error,9600,8,0,1,2)  if $error <> '' Then      MsgBox(262144,'Port Error = ',$error)  EndIf  _CommSendString($command & @CR) EndFunc   ;==>_CommGetLineStates ;=============================================================================================== After adding I wrote the below code for sending AT command to modem port but its not working.
      Please check the below code and let me know for the issue.
      ;===================================================================================== #include "C:\Program Files (x86)\AutoIt3\SciTE\CommMG.au3" #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3>    Global $key = RegRead("HKLM\HARDWARE\DEVICEMAP\SERIALCOMM","\Device\ssudmdm0000")     Local $iError = 0     If @error Then        ; The server is probably offline/port is not opened on the server.        $iError = @error         MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Client:" & @CRLF & "Could not connect, Error code: " & $iError)         Else         MsgBox($MB_SYSTEMMODAL, "MODEM:", $key)         EndIf Local $port=$key Local $porterror _CommSendStandard($port,$portError,"AT+CFUN=1,1") ;================================================================================================ but If I set the port number by my own in the code (for eg :- port number 8 or any value  instead of $key) it works fine and the modem gets reset.I want to know if there is any way to get the port number to a variable $port and discarding so that my above code works fine...In that case user donot have to take care of entering the port manually everytime and the script will automatically read the port number and set itself.
       
      Please help
       
      Regards,
      SAM
       
       
    • By mikkokh
      Hi.
       
      I have several different devices connected to my desktop PC with USB COM adapters.
       
      Sometimes there is some error that will cut my USB COM device communication (usualy caused by lose USB connector)... After reconnecting that USB COM adapter, by some reason, Windows will give it different COM port number.
      I know there are some devices with integrated COM port circuit and they are used by client programs that can found them and only them by some USB hardware relate details and then use their COM port to communicate with correct COM device.
      It would be better to define some known and static hardware related string from device managers USB COM adapter details to my script config file, than always redefine different COM port to it.
       
      How can I do this trick with autoit?
       
      I communicate COM devices with cfxUDF.au3 AutoIt UDF.
×
×
  • Create New...