Jump to content

Search the Community

Showing results for tags 'comm port'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office


  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Member Title




Found 2 results

  1. Another project idea that I am trying to get working. A USB GPS device needs to be assigned COMM Port 25 when it is plugged into the computer. It obviously gets the first open port when plugged in the first time and if I manually change it to 25 it will get a new port again if somebody plugs the device into a new USB port. So I want to make a script that can detect the device, and move/configure its port automatically. I started off finding this UDF: https://www.autoitscript.com/forum/topic/128546-serial-port-com-port-udf/?page=32 It was useful for finding the device is plugged in and what port its on, but it does not have the ability to actually change the port. I think that will have to be done via registry, or perhaps via Objects. I just want to double check my facts here and get a grip on what I need to do. Registry has the following keys that change: HKLM\HARDWARE\SERIALCOMM - \Device\ProlificSerial0 This key just lists the COMM Port for the device, it changes based on its current port. HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_067B&PID_2303] Under this key is a subkey that will duplicate every time the device gets a new port, I have not figure out quite yet how to determin what that subkey will be named, but it has the "FriendlyName" key and also the Device parameters\PortName key Both of those are unfortunately SYSTEM level permission so that makes scripting a change even harder. Last is HKLM\SYSTEM\CurrentControlSet\Control\COM Name Arbiter This contains the record of what comm ports are occupied or vacant via binary to hex. I would have to find a way to read its current value and change it to show port 25 taken and if possible free up the port taken by the device before the change. Not sure how to write something like that. Has anybody done something like this before? If so what was your best approach?
  2. Dear all (and especially Martin, if available), I am working on a GUI that reads the signals from a gas flow meter (ProFLow 6000, by Restek). In the manual of the device, there are the instructions for how to read the signal using a computer via comm ports. I can do it using the CommMG.au3 UDF by Martin, it works fine. However, I am trying to make a GUI in which there are 2 buttons: start and stop, the start button starts the reading of the comm port signal, and the stop button stops it. I did this following the tutorial available on https://www.autoitscript.com/wiki/Interrupting_a_running_function , more specifically the first example for GUI message loop mode that employs GUIRegisterMsg as a way to enable a function to stop another. It works, the start function is stopped by the stop button. However, if I try to start again, it does not work. I press the start button and nothing happens. I must say that this only happens if I use a function to read the comm port. For other kinds of functions, for example, reading the computer clock, there is no problem, after stopping I can re-start again. My question is: how to make it possible to re-start the reading function for the Comm port once it was stopped using the GUIRegisterMsg? Below goes my code (sorry, it is my first time and I am not sure of the best way of pasting it here). If includes also the clock button that can be used to test the stopping process (it should work). #include "commMG.au3" #include <GUIConstantsEx.au3> #include <ColorConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Local $FlowMeterPort Local $PortError $Interrupt_flag = 0 $FlowMeter = GUICreate("Flow meter reader", 200, 160, 500, 200) $Reading = GUICtrlCreateLabel("",20,40,120,18) GUICtrlSetBkColor($Reading,$COLOR_WHITE) $Start = GUICtrlCreateButton("Start", 20, 60, 50, 20) $Stop = GUICtrlCreateButton("Stop", 20, 80, 50, 20) $Clock = GUICtrlCreateButton("Clock", 20, 100, 50, 20) $FlowMeterPort = InputBox("Flow meter reader","Welcome to the flow meter reader! Please type in the number of the COM port connecting the computer to the flow meter. If you do not know, go to Control Panel, Hardware settings, and try to find it among the listed COM ports.") GUISetState() GUIRegisterMsg($WM_COMMAND, "FlowMeter_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Start _CommSetPort($FlowMeterPort, $PortError, 115200, 8, 0, 1, 2) $Interrupt_flag = 0 While $Interrupt_flag = 0 $FlowMeterReading = _CommReadString(100) GUICtrlSetData($Reading,$FlowMeterReading) WEnd Case $Clock $Interrupt_flag = 0 While $Interrupt_flag = 0 GUICtrlSetData($Reading,@HOUR & @MIN & @SEC) WEnd EndSwitch WEnd Func FlowMeter_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) If BitAND($wParam, 0x0000FFFF) = $Stop Then $Interrupt_flag = 1 EndFunc Func _CommReadString($TimeSpan) Local $Reading $Start = TimerInit() $End = 0 $ReadStep = 0 While $End < $TimeSpan $Reading = $Reading & _Commgetstring() $End = TimerDiff($Start) If $Reading <> '' Then $ReadStep = $ReadStep + 1 EndIf If $ReadStep > 100 Then $End = $TimeSpan Sleep(0) WEnd Return $Reading EndFunc ;==>_CommReadString
  • Create New...