Sign in to follow this  
Followers 0
soloprt

select com port and show what device is connected to it

1 post in this topic

#1 ·  Posted

hi  am new and i just started learning autoit

am starting to do a little program that can help me in my work

i dont know how to do it correctly : a combobox that shows what com port are connected to devices in the computer and when i choose a port and click on a button called info_port  i want that he desplay in $result the name of the device connected to the choosen com port.

i want to use this file to help me : CommMG.au3

thanks

#include 'CommMG.au3' ;comm ports library
Global $result = GUICtrlCreateEdit("", 364, 135, 568, 595)
Global $info_port = GUICtrlCreateButton("Info", 291, 85, 56, 25)
Global $Port = GUICtrlCreateCombo("", 150, 85, 135, 24)
$portlist = _CommListPorts(0)

If Not @error = 1 Then
    For $pl = 1 To $portlist[0]
        GUICtrlSetData($Port, $portlist[$pl])
    Next
EndIf

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg

 

CommMG.au3

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
Sign in to follow this  
Followers 0

  • Similar Content

    • kcvinu
      How to make a newline in Word with COM
      By kcvinu
      Hi all (Especially @water)
      I wonder how to do this task in word from autoit.
      Assume that i pasted some text into word with this code.
      Local $oWord = ObjGet("","Word.Application") Local $wRangeObj = _Word_DocRangeSet($oWord, 0) Local $data = ClipGet() $wRangeObj.Text = $data $wRangeObj.Font.Bold = True So far so good. Now, i need to enter a new line in word and turn the Font.Bold = False.  
      Currently, i did it with activating the word window and Send() function. But i would like to do it with the help of COM object. How can i do that ? 
    • TheDcoder
      WMI Object Code conversion to AutoIt
      By TheDcoder
      Hello, I found a VB snippet which I would love to use in AutoIt
      strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Process") For Each objItem in colItems Wscript.Echo objItem.Name Wscript.Echo objItem.CommandLine Next Despite my best efforts, I am not able to understand a thing from that piece of code . All I know is that it outputs the Name and Commandline of all the processes currently running (Let's see if I am right).
      Can anyone help me with convert this into AutoIt? Thanks in Advance!
    • jiggunjer
      Event-based scripting with the windows shell COM object
      By jiggunjer
      I want to listen for certain windows events like window open/closed. After reading the help I think I need to use ObjCreate('shell.application') and ObjEvent with that object to create/register a listener. The problem is I don't know what interface or events (i.e. the specific event names) are available for the listener. I tried searching MSDN but it is a labyrinth and I'm not that familiar with the programming frameworks/models used by Windows, and all the examples seem to refer to compiled code using .NET or some other api.
      Can any1 point me in the right direction? Also is using COM objects considered the 'modern' way to do this, or should I be using some other framework/resources?
    • Trolleule
      Object Item not exists, how to catch error?
      By Trolleule
      Hi,
      when i try to access an object item, i get an error, but don't know how to catch this error:
       
      Func GetFirewallRule($sName)     Local $oPolicy = ObjCreate("HNetCfg.FwPolicy2")     MsgBox(0, "test", $oPolicy.Rules.Item($sName)) ; throws error: The requested action with this object has failed. EndFunc Thanks in advance
    • kcvinu
      How can i change the page background color in word
      By kcvinu
      Hi all,
      I am trying to change the background color of a page in word document. But i am getting error. This is my code.
      Local $owObj = ObjGet("","word.application") If @error Then ConsoleWrite("Obj Error " & @CRLF) Local $odoc = $owObj.ActiveDocument Local $colorArray = [136,151,109] ; Olive Green $odoc.Background.Fill.ForeColor.RGB = _ColorSetRGB($colorArray) $odoc.Background.Fill.Visible = True $odoc.Background.Fill.Solid() If @error Then ConsoleWrite("Error in Color change - " & @error & @CRLF) $owObj = 0 Exit And this is the error msg
      Error in Color change - -2147352571 EDIT : I would like to know about using rgb colors in autoit.