Znuffie Posted April 23, 2010 Posted April 23, 2010 (edited) Hi, I'm writing a small script like this: #include <GUIConstantsEx.au3> Example() 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 Do $msg = GUIGetMsg() If $msg = $n2 Then MsgBox(0, "Selected listbox entry", GUICtrlRead($dialcode) & GUICtrlRead($prefix)) ; display the selected listbox entry EndIf 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 Edited April 23, 2010 by Znuffie
Znuffie Posted April 23, 2010 Author Posted April 23, 2010 Nevermind, I figured it out: ... Func ReadCtrlData($ctrl) $data = GUICtrlRead($ctrl) $data2 = StringSplit($data, " ") return $data2[1] EndFunc ...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now