Jump to content

Populate label with combo selection


Recommended Posts


I am pulling two sets of data from a WMI call to a SMS Server

One is a Collection ID, the other is the friendly Name given to the Collection ID

Below are two examples of what I mean

Collection ID   Collection Name

SMS00001         All Systems

I have a Combo list of all the Collection ID's, but want to show the friendly Collection name in a corresponding label.

Obviously when the selection changes in the combo box, the label needs to change accordingly.

Any ideas on where to start?

Edited by lyledg
Link to comment
Share on other sites

I'm assuming you have a While loop and Select Case.

Global $Label ; The Label
Global $combo ; The Combo

While 1
    $msg = GUIGetMsg () ;Recive Changes in the GUI
        Case $msg = $GUI_Event_Close ;Closes if the close button is pressed
        Case $msg = $combo ;Starts if the combo has changed.
            GUICtrlSetData ($Label, $combo)

Hope that helps

Link to comment
Share on other sites

Thanks for the reply Bert, but I think I'll be a bit clearer in my explanation..

Below is a graphical representation of the data I am using

I need to have the corresponding Collection Name change when a new selection is made in the Collection ID combo box.

Don't I need to read the Collection Name into an array, so that when the combo selection changes, so will the corresponding information in the label?


Edited by lyledg
Link to comment
Share on other sites

  • Moderators

I've looked at this post every time you've posted in it from the beginning. I personally haven't responded, because I really have no idea without some type of code attempt what your description of what you are trying to do is implying. We have no files to work with, nothing... if you can't do the work yourself, then take some time and make a step by step graph or outline of what you are hoping to achieve.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Smoke, thanks for the reply..

Ok, Here is what I am trying to acheive

I have a combo box, which is populated with data from a WMI query as shown below:

$MAINFORM = GUICreate("", 538, 518, -1, -1)
$COLLECCOMBO = GUICtrlCreateCombo("", 108, 104, 194, 40)
$Collectionlbl = GUICtrlCreateLabel("Friendly name here", 320, 104, 180, 21, $SS_SUNKEN)

Func _QueryAllCollections()

; Execute WMI Query
    $oCollectionSet = $sms.ExecQuery ("SELECT * FROM SMS_Collection")

; Loop through results and output collection information
    For $oCollection In $oCollectionSet
;Set the SMS Collection ID
    $Collectionids = $oCollection.CollectionID
;Set the SMS Friendly name
    $Collectionnames = $oCollection.Name
;Set the Combo boxes with the data collected
    GUICtrlSetData($COLLECCOMBO, $Collectionids)
oÝ÷ ÙhZ´¦¶¼¢hiÈ^÷¢²ØZ·^Ø^~*ìµéí¯*¶¢fènb²Ç¥yË^t¯j¸nW®´ß ¨W¶*'ÛÁ©í¶¢ºÞ²'v)à~¸Ùr©Ó~¢Y^rبv¦zÇb²ZÉçbØ^¦ÞMú
eyËb¢yÚë1-4ÓP%,¬µé¬HÄ´ÓMU,z»1-4Óp%K¬jèº?r^!©l¡ú.ÛaÇ(uì!Èfmmë¬yû¥¶§uê쵩Ý­!©­¯(§Úr½æ®¶­s` ¢6æ6ÇVFRfÇC´wV6öç7FçG2æS2fwC°¢6æ6ÇVFRfÇC´wV6öÖ&òæS2fwC° ¤÷Bb33´×W7DFV6Æ&Uf'2b33²Ã ¤FÒb33c´6öÖ&òÂb33c·&WBÂb33c´'FåôWBÂb33c¶×6rÂb33c·5÷FW@ ¤wV7&VFRgV÷C´6öÖ&ô&÷vWB7W'&VçB6VÆV7FöâgV÷C²Â3"Â#SB ¢b33c´6öÖ&òÒwV7G&Ä7&VFT6öÖ&ògV÷C´Ö¶R6ö6RgV÷C²ÂsÂÂ#sÂ#¤uT7G&Å6WDFFb33c´6öÖ&òÂgV÷C´FVÓÄFVÓ'ÄFVÓ2gV÷C²¢b33c´'FåôWBÒwV7G&Ä7&VFT'WGFöâgV÷C´WBgV÷C²ÂSÂÂÂ3¤wV6WE7FFR¥vÆR¢b33c¶×6rÒwVvWD×6r¢6VÆV7@¢66Rb33c¶×6rÒb33c´uTôUdTåEô4Äõ4R÷"b33c¶×6rÒb33c´'FåôW@¢WDÆö÷¢66Rb33c¶×6rÒb33c´6öÖ&ð¢ôuT7G&Ä6öÖ&ôvWDÄ%FWBb33c´6öÖ&òÅôuT7G&Ä6öÖ&ôvWD7W%6VÂb33c´6öÖ&òÂb33c·5÷FWB¢6VÆV7@¢66Rb33c·5÷FWBÒgV÷C´FVÓgV÷C°¢×6t&÷ÂgV÷C·FW7BgV÷C²ÂgV÷C´FVÓv26VÆV7FVBgV÷C²¢66Rb33c·5÷FWBÒgV÷C´FVÓ"gV÷C°¢×6t&÷ÂgV÷C·FW7BgV÷C²ÂgV÷C´FVÓ"v26VÆV7FVBgV÷C²¢66Rb33c·5÷FWBÒgV÷C´FVÓ2gV÷C°¢×6t&÷ÂgV÷C·FW7BgV÷C²ÂgV÷C´FVÓ2v26VÆV7FVBgV÷C²¢VæE6VÆV7@¢VæE6VÆV7@¥tVæ@¤W@
Edited by lyledg
Link to comment
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.
  • Create New...