Jump to content

Recommended Posts

Posted

I populate a listbox with lines from a file. I see the listbox being filled up but then at the end--it clears itself! :)

$calls is the name of the listbox

; extract file

$file_name = GUICtrlRead($config)

$file = FileOpen($file_name, 0)

while 1

$line = FileReadLine($file)

GUICtrlSetData($calls, $line)

Wend

FileClose($file)

Posted

I populate a listbox with lines from a file. I see the listbox being filled up but then at the end--it clears itself! :)

The last line in the file is NUL so GUICtrlSetData() takes the NUL and clear the listbox

Change:

GUICtrlSetData($calls, $line)oÝ÷ Ù:ºÚ"µÍY    ÌÍÛ[H    ÉÝÈ  ][ÝÉ][ÝÈ[ÕRPÝÙ]]J    ÌÍØØ[Ë ÌÍÛ[J
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Posted (edited)

Works a treat. Many thanks. :)

Now...

I need a loop that processes each item of the listbox

eg

While not end of listbox

alpha = listbox(next_item)

do_stuff(alpha)

Wend

Edited by dazza
Posted

use

#Include <GuiListBox.au3>
$count = _GUICtrlListBox_GetCount(GUICtrlGetHandle($ListBox))

For $index = 1 To $count-1
_GUICtrlListBox_GetText(GUICtrlGetHandle($ListBox),$index)
Next

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Posted

My build doesn't have GuiListBox3. :)

Is there a way of extracting each item (and having it selected) without the above?

;~ $LB_GETCOUNT = 0x18B
;~ $LB_GETTEXT = 0x189

    $hwnd_lb = ControlGetHandle("Your title","","ListBox1")
    $count = dllcall("user32.dll","int","SendMessage","hWnd",$hwnd_lb,"int",$LB_GETCOUNT,"int",0,"int",0)

    For $i = 0 to $count[0] - 1
        $line_text = dllcall("user32.dll","int","SendMessage","hWnd",$hwnd_lb,"int",$LB_GETTEXT,"int",$i,"str","")
        $line_text = $line_text[4] 
        ConsoleWrite($line_text & @LF)
    Next
Posted

This code picks out each member of the list beautifully--many thanks.

Is there a way I can highlight each member as it's processed.

i.e. make the 7th member (of the listbox) selected (darkened out)

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
×
×
  • Create New...