Jump to content

Read Checked ListView Item


Recommended Posts

Hello,

I am Try To Read The Checked ListViewItem But i Cant understand it please Help Me.

#include <GuiConstants.au3>
#include <GuiListView.au3>
#include <File.au3>
#include <GuiList.au3>
Dim $DataLocation,$ListItems,$LoopCtr,$ret
$DataLocation = "C:\Temp\"
_FileCreate($DataLocation & "CompList.TXT")
RunWait(@ComSpec & ' /c net view >' & $DataLocation & 'CompList.txt', $DataLocation, @SW_HIDE)
$NoOfItems = _FileCountLines($DataLocation & "CompList.TXT")
_FileReadToArray($DataLocation & "CompList.TXT", $ListItems)
GUICreate("ListView Set Check State", 392, 322)
$listview = GUICtrlCreateListView("Computer Name", 40, 30, 310, 149, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_REGIONAL))
$Button1 = GUICtrlCreateButton("Check",100,200,80,25)
For $LoopCtr = 4 To $NoOfItems - 2
    $ComputerNNameWithSlash = StringSplit($ListItems[$LoopCtr], " ")
    $ComputerName = StringSplit($ComputerNNameWithSlash[1], "\\")
    GUICtrlCreateListViewItem($ComputerName[3],$listview)
Next
    GUICtrlCreateListViewItem("Computer2",$listview)
    GUICtrlCreateListViewItem("Computer3",$listview)
    GUICtrlCreateListViewItem("Computer4",$listview)
    GUICtrlCreateListViewItem("Computer5",$listview)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
        Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
EndSelect

WEnd

:o

[topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic]

Link to post
Share on other sites

#include <GuiConstants.au3>
#include <GuiListView.au3>
#include <File.au3>
#include <GuiList.au3>
Dim $DataLocation, $ListItems, $LoopCtr, $ret
$DataLocation = "C:\Temp\"
_FileCreate($DataLocation & "CompList.TXT")
RunWait(@ComSpec & ' /c net view >' & $DataLocation & 'CompList.txt', $DataLocation, @SW_HIDE)
$NoOfItems = _FileCountLines($DataLocation & "CompList.TXT")
_FileReadToArray($DataLocation & "CompList.TXT", $ListItems)
GUICreate("ListView Set Check State", 392, 322)
$listview = GUICtrlCreateListView("Computer Name", 40, 30, 310, 149, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_REGIONAL))
$Button1 = GUICtrlCreateButton("Check", 100, 200, 80, 25)
For $LoopCtr = 4 To $NoOfItems - 2
    $ComputerNNameWithSlash = StringSplit($ListItems[$LoopCtr], " ")
    $ComputerName = StringSplit($ComputerNNameWithSlash[1], "\\")
    GUICtrlCreateListViewItem($ComputerName[3], $listview)
Next
GUICtrlCreateListViewItem("Computer2", $listview)
GUICtrlCreateListViewItem("Computer3", $listview)
GUICtrlCreateListViewItem("Computer4", $listview)
GUICtrlCreateListViewItem("Computer5", $listview)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            For $X = 0 To _GUICtrlListViewGetItemCount ($listview) - 1
                If _GUICtrlListViewGetCheckedState ($listview, $X) Then
                    MsgBox(0, "Checked", _GUICtrlListViewGetItemText ($listview, $X))
                EndIf
            Next
    EndSelect
    
WEnd

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...