Sign in to follow this  
Followers 0

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


#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])

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg



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

    • 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
      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. 
    • Quantumation
      How do you make UDF's?
      By Quantumation
      I'm new to scripting and Autoit, but i've already found some things that I would like to create. Where do you start when creating a UDF?
      For instance, if I wanted to make a UDF for Excel(I know one exists) Where would I start? What would I need to start researching?
      Any input would be appreciated
    • timepp
      What's the next step after "QueryInterface"
      By timepp
      I already have a COM object. I want to query another interface and call method from that interface. I expect something like this:
      Local $pp $app.QueryInterface($tRIID_IServiceProvider, $pp) Bind($pp, $dtag_IServiceProvider) $pp.QueryService(...) in line 3, I want to bind a vtable to this variable (or something similar) but currently there seems no such mechanism.
      or something like this:
      Local $pp = QueryInterface($app, $tRIID_IServiceProvider, $dtag_IServiceProvider) $pp.QueryService(...) but no such thing either.
      The only workable solution I know is the following:
      Local $pp $app.QueryInterface($tRIID_IServiceProvider, $pp) Local $provider = ObjCreateInterface($pp, $sIID_IServiceProvider, $dtag_IServiceProvider) $provider.QueryService(...) but apparently there is a duplication for IID_IServiceProvider, which violates the DRY(don't repeat yourself) principle.
      Is there any other better solution?