Jump to content
Sign in to follow this  

Getting just a part of a control

Recommended Posts


Hi, I'm writing a small script like this:

#include <GUIConstantsEx.au3>


Func Example()
    GUICreate("Contacts", 800, 200)

    $dialcode = GUICtrlCreateList("", 5, 5, 100, 195)
    GUICtrlSetData($dialcode, "9| ", " ")

    $prefix = GUICtrlCreateList("", 110, 5, 100, 195)
    GUICtrlSetData($prefix, "00 (->)|011 (US)|0011 (AU)|010 (JP)|810 (RU)", "00 (->)")

    $read = GUICtrlCreateButton("Read", 10, 100, 600)
    GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button

    GUISetState() ; will display an empty dialog box
    ; Run the GUI until the dialog is closed
        $msg = GUIGetMsg()
        If $msg = $n2 Then
            MsgBox(0, "Selected listbox entry", GUICtrlRead($dialcode) & GUICtrlRead($prefix)) ; display the selected listbox entry
    Until $msg = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

How can I get just part of that control data? IE: Instead of grabbing "00 (->)", I want to read the value 00, but I want to keep "00 (->)" in the list.

Under linux I'd just do cut -d " " -f 1, but I'm kind of clueless on windows and on gui programs :idea:

Edited by Znuffie

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.