OldGuyWalking

List View and Selecting Multiple Out-of-Sequence Rows

4 posts in this topic

Hello All:

I am reading data from a ListView and based on criteria I want to have the script select certain rows in the ListView.  The script would loop through the ListView data and would select multiple rows out-of-sequence.  At the end, the script would press a button on the form which would remove the selected rows.

I'd originally had the script read a row and if criteria was met it would click on the button and remove that row.  In some cases there can be thousands of rows in the listview and clicking a button and then moving back to the listview was slow.  Selecting all affected rows and then pressing the button once would speed things up.

I've tried various functions and GUI UDF's to select a row but each time I ran the script I'd only get 1 row selected when I know there are dozens of records that should be selected.   What I think is happening is that the ControlSend method I was using to move down the rows by sending the ListView a Down key may have been deselecting each selected row as soon as the Down Arrow was sent.

Everything except for the Selection piece is working.  I've looked through the help files and the forums and could not find information on another way to cycle through the ListView rows.  I've included the code below along with each of the functions or UDF's I tried.

Could someone let me know if there is another way to move through the Listview rows other than using ControlSend that won't deselect Selected records?  If that's not an option, can someone let me know if there's another way to select rows in a ListView that won't be affected by the Down Arrow key?

Thank you.

Bill

#AutoIt3Wrapper_UseX64=Y

#include <MsgBoxConstants.au3>
#include <array.au3>
#include <GuiListbox.au3>
#include <GuiToolbar.au3>
#include <GuiListView.au3>

HotKeySet("!{Esc}", "Terminate")

Opt("MustDeclareVars", 1) ; Must declare variables
Opt("WinTitleMatchMode", 2) ; Can match substrings in title

Dim $hWnd ; main Title handle
Dim $hCntrlLV1 ; List View handle ("SysListView328")

Dim $sSubject ; Column 0
Dim $sStatus ; Column 1
Dim $sSize ; Column 2
Dim $sDate ; Column 3
Dim $sPoster ; Column 4
Dim $sGroup ; Column 5

Dim $bDelete = False
Dim $iMaxRows ; Total Rows in List View
Dim $iMaxCols ; Total Columns in List View
Dim $iCurRow ; Current Row being read
Dim $iSelected ; Total items Selected

Dim $sTitle1 = "Main Title"

If WinExists($sTitle1, "") Then

    $hWnd = WinActivate($sTitle1, "")
    If @error Then
        MsgBox(48, $sTitle1, "Could not activate the form.")
        Terminate
    EndIf

    $hCntrlLV1 = ControlGetHandle($hWnd, "", "SysListView328")

    ControlFocus($hWnd, "", $hCntrlLV1)
    $iMaxRows = ControlListView($hWnd, "", $hCntrlLV1, "GetItemCount")
    $iMaxCols = _GUICtrlListView_GetColumnCount($hCntrlLV1)

    ControlSend($hWnd, "", $hCntrlLV1, "{Home}")

    $iCurRow = 0 ; Zero based row in listview

    Do
        $bDelete = False ; Default

        ; This reads the data - (tested - no problem).

        $sSubject = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 0)
        $sStatus = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 1)
        $sSize = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 2)
        $sDate = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 3)
        $sPoster = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 4)
        $sGroup = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 5)


        ; Identifies if a row should be deleted and sets the flag $bDelete to True (tested - no problem).
        Select

            Case StringLeft($sStatus, 8) = "Idle/Old"
                $bDelete = True

            Case StringInStr($sGroup, "Test1") > 0
                $bDelete = True

            Case StringInStr($sSubject, "Test2") > 0
                $bDelete = True

        EndSelect

        ; If the row should be deleted, select it in the same way as a Ctrl+Left Mouse Click.

        ; (tested the following but the "select" didn't stick.  See note below regarding ControlSend Down. 

        If $bDelete = True Then ;
            ;_GUICtrlListView_SetItemSelected($hCntrlLV1,$iCurRow)
            ; ControlListView($hWnd, "", $hCntrlLV1,"Select", $iCurRow)
            ;_GUICtrlListView_SetSelectionMark($hCntrlLV1, $iCurRow)
            $bDelete = False ; Reset the flag
        EndIf

        ;   Move to the next row and increment the current row counter. (tested - no problem).

        ; Pressing the down arrow deselects any Selected records.       
        ; Is there another method for moving up or down a listview?
        ControlSend($hWnd, "", $hCntrlLV1, "{Down}")
        $iCurRow = $iCurRow + 1

        ; Keep going until the end of the List View is reached.
    Until $iCurRow = $iMaxRows

    ; Get the number of items "Selected" in the List View. (tested - Both show 1 record selected.)

    $iSelected = 0
        $iSelected = ControlListView($hWnd, "", $hCntrlLV1, "GetSelectedCount")
    MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$iSelected' & @CRLF & @CRLF & 'Return:' & @CRLF & $iSelected) ;### Debug MSGBOX

    $iSelected = 0
    $iSelected = _GUICtrlListView_GetSelectedCount($hCntrlLV1)
    MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$iSelected' & @CRLF & @CRLF & 'Return:' & @CRLF & $iSelected) ;### Debug MSGBOX

    If $iSelected > 0 Then
        ;   MouseClick("left",506,70,1) ; This clicks a button to remove records. (tested by clicking button when cycling through each record - no problem)

    EndIf

Else

    MsgBox(0, "Error", "Form not active.") ; If the program isn't running then error out and quit

EndIf

Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

Share this post


Link to post
Share on other sites



OldGuyWalking,

ListViews can be created with either a single or multiple selection style - can you manually (usually with Ctrl pressed) select multiple options within the ListView?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Instead of selections you could try this :
1st step
- create an array "rows to remove"
- loop through the listview rows, get text, check the criteria, if true then store the row index in the array
2nd step
- loop through the array and use _GUICtrlListView_DeleteItem on each stored index

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Melba23 - yes I can do a Control+Left Mouse Click in the listview. 

Mikell - Thank you. I'd thought of doing that.  I've done that in other scripts (I think I have another post somewhere on here where I did that exact thing except with comma delimited data I was pulling from the clipboard) .  In this case I'm working with a third party application so I have to work within their application.  I need to select the rows and then have the script press a button (Mark Items as Old) in the application.  It doesn't delete the rows, it just hides them.  I'm writing this because I've waited for over 2 years for the programmer to fix a filtering problem in their program that displays records that had previously been flagged as old but keep showing up.

Anyways - I have neighbors across the courtyard who decided to stay up and chat loudly (I think drinking was involved) until 4:30 this morning so I had time to keep plugging away at the problem.    Turns out I just hadn't found the right combination.  Trial and error wins again. 

The command I needed to use to move through the ListView without deselecting rows (the imporant part) was

_GUICtrlListView_GetNextItem($hCntrlLV1, 1).  <<-- This second parameter tells the function which row to start from.  I put this outside the loop.  Once the loop starts the command is  _GUICtrlListView_GetNextItem($hCntrlLV1) without the 2nd parameter.

The ControlListView($hWnd, "", $hCntrlLV1, "Select", $iCurRow) command selects and highlights the row.  (The other two "select" functions I'd tried (see code) didn't seem to do anything with this ListView.)

Anyway, thank you for the suggestions.  Turned out I only had to read just about every _GUIListView command before I came across the right one.  2 hours well spent.... heh.

 

If WinExists($sTitle1, "") Then

    $hWnd = WinActivate($sTitle1, "")
    If @error Then
        MsgBox(48, $sTitle1, "Could not activate the form.")
        Terminate
    EndIf

    ; Added this temporarily until I figure out why the Control Handle changed.
    MouseClick("left", 230, 316)
    $hCntrlLV1 = ControlGetFocus($hWnd)

;   $hCntrlLV1 = ControlGetHandle($hWnd, "", "SysListView328")

    ControlFocus($hWnd, "", $hCntrlLV1)
    $iMaxRows = ControlListView($hWnd, "", $hCntrlLV1, "GetItemCount")
    $iMaxCols = _GUICtrlListView_GetColumnCount($hCntrlLV1)

    ControlSend($hWnd, "", $hCntrlLV1, "{Home}")

    $iCurRow = 0 ; Zero based row in listview

    ; Added this. This sets the starting point.  There's a 2nd one around
    ; line 102 that actually cycles through the ListView. It doesn't 
    ; move from row to row in the same way that ControlSend ({Down}) would.
    _GUICtrlListView_GetNextItem($hCntrlLV1, 1)

    Do
        $bDelete = False ; Default

        ; This reads the data - (tested - no problem).

        $sSubject = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 0)
        MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$sSubject' & @CRLF & @CRLF & 'Return:' & @CRLF & $sSubject) ;### Debug MSGBOX
        $sStatus = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 1)
        $sSize = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 2)
        $sDate = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 3)
        $sPoster = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 4)
        $sGroup = ControlListView($hWnd, "", $hCntrlLV1, "GetText", $iCurRow, 5)


        ; Identifies the data and sets the flag $bDelete to True (tested - no problem).
        Select

            Case StringLeft($sStatus, 8) = "Idle/Old"
                $bDelete = True

            Case StringInStr($sGroup, "test1") > 0
                $bDelete = True

            Case StringInStr($sSubject, ".txt") > 0
                $bDelete = True

        EndSelect

        ; If the row should be deleted, select it in the same way as a Ctrl+Left Mouse Click.

        ; (tested the following. The first one works and displays each row that's selected..)

        If $bDelete = True Then ;
            ControlListView($hWnd, "", $hCntrlLV1, "Select", $iCurRow)
            ;_GUICtrlListView_SetSelectionMark($hCntrlLV1, $iCurRow)
            ;_GUICtrlListView_SetItemSelected($hCntrlLV1,$iCurRow)
            $bDelete = False ; Reset the flag
        EndIf

        ;   Move to the next row and increment the current row counter. (tested - no problem).

        ; Pressing the down arrow deselects any Selected records.
        ; This cycles to the next row in the listview
        _GUICtrlListView_GetNextItem($hCntrlLV1)
        ;ControlSend($hWnd, "", $hCntrlLV1, "{Down}")
        $iCurRow = $iCurRow + 1

        ; Keep going until the end of the List View is reached.
        ; Verified what row was being checked and if more than one row was being
        ; selected. 
        ; $iSelected = ControlListView($hWnd, "", $hCntrlLV1, "GetSelectedCount")
        ; MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, '$iSelected = ' & $iSelected & @CRLF & '$iCurRow = ' & $iCurRow) ;### Debug MSGBOX

    Until $iCurRow = $iMaxRows

    ; Get the number of items "Selected" in the List View.
    $iSelected = 0
    $iSelected = ControlListView($hWnd, "", $hCntrlLV1, "GetSelectedCount")
    MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, '$iSelected = ' & $iSelected & @CRLF & '$iCurRow = ' & $iCurRow) ;### Debug MSGBOX

    If $iSelected > 0 Then
        ;   MouseClick("left",506,70,1) ; This clicks a button to remove records. (tested by clicking button when cycling through each record - no problem)
    EndIf

Else

    MsgBox(0, "Error", "Form not active.") ; If the program isn't running then error out and quit

EndIf

 

 

Edited by OldGuyWalking
Just some minor clarifications, grammar fixes, and spelling corrections.

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

  • Similar Content

    • damon
      By damon
      @JLogan3o13 I apologize, I did not think of it that way.  I have attached all the code and the Ini File information.  Please let me know if I need to add anything else to help understand what is happening.  thank you.
       
       
       
      Guys, I apologize in advance as I did not search for my answer before posting.  I just could not figure out a way to search that made since so I decided to go ahead and post my question.
       
      Getting to it.
      Background: this is being used to validate file names before moving to a new location.  though i have not included all the code, below is what i am having a problem with.
       I have an ini file that i am reading values from. Func ConfigDefineVars() -- I read the value of $ValidationRDA and everything is good then I set 
      $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation]' <> $ValidationRDA
      the code that will be used in the select case in Func FileSplitCount().  The problem i have is that even though the numbers = each other they are not recognizing as =.  
      This is what i am getting in my log file i create.
      2017-12-04 14:09:53 : RDA was 2403 should have been 2403:
      If I move $SplitFile[$ValidationRDALocation] <> $ValidationRDA to the Case line under the function it works correctly.
       
      I think this has to do with my use of ' ' around the '$SplitFile[$ValidationRDALocation]' but  i don't know what option i have in Func ConfigDefineVars I am not ready to define $SplitFile.  I have tried adding it to my Global Vars at the top of my script but that did not seem to help.
      There will be more fail this is just the first one in the select case.
       
      Any help or ideas would be greatly appreciated.
       
      thanks,
      Damon
      Example of a filename used.
      DWRSSD-37087-95-026.%-064.00-Tatum Family %-%-1230 Academy Rd-%-PERM-TRUE-2403.pdf
      This file will fail on the 95, it should be 095.  The problem i am getting is with the 2403 it fails even though the ini file value ValidationRDA = 2403 
       
       
      Ini File:
      [SSD_FolderPaths]
      pendingFolder=C:\Users\bg01152\Desktop\SSD Test\pending
      reviewFolder=C:\Users\bg01152\Desktop\SSD Test\review
      completedFolder=C:\Users\bg01152\Desktop\SSD Test\Completed
      FileNetProperties=DocumentTitle,ZipCode,County,MapAndGroupID,ParcelID,PropertyOwner,Subdivision,StreetAddress,LotNumber,DocumentType,Approved,RDANumber
      ValidationDocumentTitle=DWRSSD
      ValidationDocumentTitleLocation=1
      ValidationCountyCodeLocation=3
      ValidationRDA=2403
      ValidationRDALocation=12
      Validation3=TRUE
      Validation3Location=11
      Validation4=PERM
      Validation4Location=10
       
       
      #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> ;------------Global Vars --------------------- Global $SplitFile, $aFileList, $FileLog, $dFolder, $sFolder, $cFolder, $ConfigFile, $t Global $ValidationDocumentTitle, $ValidationDocumentTitleLocation, $ValidationCountyCodeLocation, $ValidationRDA Global $ValidationRDALocation, $Validation3, $Validation3Location, $Validation4, $Validation4Location, $FileNetPropertiesSplit Global $CaseCountyCheck, $CaseRDALocationCheck, $CaseValidation3LocationCheck, $CaseValidation4LocationCheck, $SplitFile ;;--------------------------------Check and Read Config files-------------------------------- $SysConfigFile = @ScriptDir & "\SysConfig.ini" ;----------------PreCheck for Config File-------------- If FileExists ($SysConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- $FileNetEXE = @ScriptDir & "\" & IniRead ($SysConfigFile, "FileNetUploader","FileName","") $delimiter = IniRead ($SysConfigFile, "FileInformation", "Delimiter","") $Filter = IniRead ($SysConfigFile, "FileInformation", "Filter", "") $ConfigFile = @ScriptDir & "\Config.ini" ;----------------PreCheck for Config File-------------- If FileExists ($ConfigFile) <> 1 Then Exit EndIf ;----------------End PreCheck-------------------------- ;;-------------------------------------------------------------------------------------------- $Sections = IniReadSectionNames ($ConfigFile) ;MsgBox (0,"test", $Sections[0] & @CRLF & $Sections[1] & @CRLF & $Sections[2] & @CRLF & $Sections[3] & @CRLF & $Sections[4]);TESTING ONLY - DELETE WHEN DONE $p = 0 Do $t = 0 ;used for precheck $p = $p + 1 ConfigDefineVars($Sections[$p]) ;MsgBox(0,"ConfigDefineVars", $sFolder & @CRLF & $dFolder & @CRLF & $cFolder);TESTING ONLY - DELETE WHEN DONE PreCheck($dFolder, $sFolder, $cFolder) ;Runs a Pre-check to make sure folder structure exists before running the program If $t = 0 Then ;MsgBox(0,"PreCheck Run", "Running next functions");TESTING ONLY - DELETE WHEN DONE ListArray($sFolder, $Filter) ;Puts File Names in String Array ;_ArrayDisplay ($aFileList, $Sections[$p]) If $t = 0 Then FileSplitCount($dFolder, $aFileList) ;Takes filename String Array and splits by $delimiter ;MsgBox(0,"PreCheck Run2", "Running split function");TESTING ONLY - DELETE WHEN DONE Else ;MsgBox(0,"PreCheck Run2", "Skipping split function");TESTING ONLY - DELETE WHEN DONE EndIf Else ;MsgBox(0,"PreCheck Run", "Skipping next functions");TESTING ONLY - DELETE WHEN DONE EndIf Until $p = $Sections[0] ExitScript() ;Exit script Function Func ConfigDefineVars($SectionsNum);Defines Variables from config file Sections $sFolder = IniRead ($ConfigFile, $SectionsNum, "pendingFolder","") ;Pending Folder, Folder that is awaiting the process $dFolder = IniRead ($ConfigFile, $SectionsNum, "reviewFolder","") ;Review Folder, Files that did not pass validation check and division needs to review $cFolder = IniRead ($ConfigFile, $SectionsNum, "completedFolder","") ;Completed Folder, Once process is completed this would be location files get moved to $FileNetProperties = IniRead ($ConfigFile, $SectionsNum, "FileNetProperties","") $FileNetPropertiesSplit = StringSplit ($FileNetProperties,",") $ValidationDocumentTitle = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitle","") $ValidationDocumentTitleLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationDocumentTitleLocation","") $ValidationCountyCodeLocation = IniRead ($ConfigFile, $SectionsNum, "ValidationCountyCodeLocation","") $ValidationRDA = IniRead ($ConfigFile, $SectionsNum, "ValidationRDA","") $ValidationRDALocation = IniRead ($ConfigFile, $SectionsNum, "ValidationRDALocation","") $Validation3 = IniRead ($ConfigFile, $SectionsNum, "Validation3","") $Validation3Location = IniRead ($ConfigFile, $SectionsNum, "Validation3Location","") $Validation4 = IniRead ($ConfigFile, $SectionsNum, "Validation4","") $Validation4Location = IniRead ($ConfigFile, $SectionsNum, "Validation4Location","") If $ValidationCountyCodeLocation = 999 Then $CaseCountyCheck = 1 <> 1 Else ;MsgBox (0,"test of county code", "location = " &$ValidationCountyCodeLocation) $CaseCountyCheck = StringLen('$SplitFile[$ValidationCountyCodeLocation]') <> 3 ; Checks for 3 digit County Code EndIf If $ValidationRDALocation = 999 Then $CaseRDALocationCheck = 1 <> 1 Else $CaseRDALocationCheck = '$SplitFile[$ValidationRDALocation]' <> $ValidationRDA ; Checks for 4 Digit RDA EndIf If $Validation3Location = 999 Then $CaseValidation3LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation3Location]' <> $Validation3 ; Checks that Approved = True EndIf If $Validation4Location = 999 Then $CaseValidation4LocationCheck = 1 <> 1 Else $CaseValidation3LocationCheck = '$SplitFile[$Validation4Location]' <> $Validation4 ; Checks that Document Type = PERM EndIf EndFunc Func ValidationCheck ($check1) $blank = StringLen ($check1) If $check1 Then EndIf EndFunc Func PreCheck($dFolder, $sFolder, $cFolder) ;----------------PreCheck for Destination Folder-------------- If FileExists ($dFolder) <> 1 Then $t = 1 Return Else $FileLog = FileOpen($dFolder & "\FileLog.log", 1) EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Source Folder-------------- If FileExists ($sFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Pending Folder -- " & $sFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- ;----------------PreCheck for Completed Folder--------- If FileExists ($cFolder) <> 1 Then _FileWriteLog($FileLog, "Path to Completed Folder -- " & $cFolder & " -- does not exist") $t = 1 Return EndIf ;----------------End PreCheck-------------------------- EndFunc Func ListArray($sFolder, $Filter) $aFileList = _FileListToArray($sFolder, $Filter, 1) ;Create an array of files from the source folder filtering by filetype ;in the config.ini files for the specified section If @error = 1 Then ;MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") _FileWriteLog($FileLog, "Path to File(s) is Invalid") $t = 1 Return EndIf If @error = 4 Then ;MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") _FileWriteLog($FileLog, "No File(s) were found, exiting.") $t = 1 Return EndIf EndFunc ;==>ListArray  
       
       
       
    • hcI
      By hcI
      Hello
      Today I'm working on listbox but there might be something that I'm missing...
      I made a little script that allow the user to swap 2 items for the listbox. So the user select for example the 3rd item, press the button "Up" and it switch with the 2nd one, same with the "Down" button that switch with the 4th one.
      But when I select the 3rd item and switch it the item become unselected and I would like to select it again after the manipulation :
      As you can see in the comment of the script, _GUICtrlListBox_SetSel don't highlight/select them once the swap process is done..
      What am I missing ?
    • mLipok
      By mLipok
      I was not lucky to find the right function so I created it by my self:
      _GUICtrlListView_GetColumnID_ByName()
      Example:
       
      #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("ListView Get Column ID", 400, 300) Local $idListview = GUICtrlCreateListView("Alfa|Beta|Gama", 2, 2, 394, 268) GUISetState(@SW_SHOW) _GUICtrlListView_SetColumnOrder($idListview, "2|0|1") MsgBox($MB_SYSTEMMODAL, "Information", "Column ID: " & _GUICtrlListView_GetColumnID_ByName($idListview, 'Gama')) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func _GUICtrlListView_GetColumnID_ByName($hListView, $sColumnToFind) Local $iColumn_Count = _GUICtrlListView_GetColumnCount($hListView) Local $aColumns For $iColumn_idx = 0 To $iColumn_Count - 1 $aColumns = _GUICtrlListView_GetColumn($hListView, $iColumn_idx) If $aColumns[5] = $sColumnToFind Then Return $iColumn_idx EndIf Next Return SetError(1, 0, -1) EndFunc ;==>_GUICtrlListView_GetColumnID_ByName  
    • UEZ
      By UEZ
      Here a small tool I wrote to update my Sysinternal tools collection without the need to download always the whole package or visiting the site to check for updates. I know that there are several tools available (also some tools written in AutoIt) but here another one for the collection. It was good exercise for me to code it.
       
       
        
       
       
      Some files from cannot be downloaded although they are visible on the web site!
       
      Here the download link of the source code only: AutoIt Sysinternal Tools Synchronizer v0.99.1 build 2017-10-23 beta.7z  (1353 downloads previously)
      -=> Requires AutoIt version 3.3.13.20 or higher / tested on Win8.1 real machine and some VMs: Win7 / Vista / Win10
       
      Compiled exe only: @MediaFire
       
      Just select the Sysinternal Tools folder or create one and press the synchronize button to download the selected items. Click on AutoIt label (near to left upper corner) to open menu.
       
      Special thanks to LarsJ, Melba23 and mesale0077 for their help. 
       
      I've still some ideas to implement which are more gimmick related, so it is not finished yet...
      If you want to add your language please check out #Region Language. Thanks. 
       
      Please report any bug or if you have any suggestions.
       
      The language of the tool tip from each of the executable in the left list view were automatically created using Google translator and weren't checked for correctness.
       
      Br,
      UEZ
    • 0Ethan0
      By 0Ethan0
      Ahoy Autoit Community!
      After many trials and errors I am unable to solve a problem I am facing and would appreciate any kind of input or better yet a solution 
      The Premise: An embeded slideshow viewer that runs after double-clicking an item in a ListView (each item will generate a different slideshow images).
      The Setup: GUI with a ListView Control and a simple exit button.
      The Issue: Once double clicked the slide plays however the GUI "locks"/non responsive until the slide is over. Same thing if I click on the "Test" button.
      The Culprit: I believe since it's in the images loop it can't accept any other commands until that loop is over.
      The Wish: I want to be able to use the GUI functions (selecting other items, clicking on button etc.) while the slideshow plays.
      The Code (stripped and simplified as much as I could):
      #include <GuiListView.au3> #include <File.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) HotKeySet("{Esc}", "_Exit") Global $c=0 Global $ssGDI[3], $ssGraphic[2], $ssImage Global Const $bg_color = "000000" Global Const $ssW = 480, $ssH = 320 Global $aFiles = _FileListToArrayRec("d:\testStage\", "*.jpg;*.png;*.bmp;*.gif;*.JPG;*.PNG;*.BMP;*.GIF", $FLTAR_FILES, $FLTAR_NORECUR ,$FLTAR_SORT ,$FLTAR_FULLPATH ) $guiW = 1200 $guiH = 726 $mainWindow = GUICreate("Slideshow Viewer", $guiW, $guiH, -1, -1, $WS_POPUP) $Button1 = GUICtrlCreateButton("Exit", 0, 0, 50, 50) GUICtrlSetOnEvent($Button1, "_Exit") $Button1 = GUICtrlCreateButton("Test", 60, 0, 50, 50) GUICtrlSetOnEvent($Button1, "Test") Global $ListView = GUICtrlCreateListView("Entry Name|Category", 5, 75, 195, 280) _GUICtrlListView_SetColumnWidth ($ListView, 0, 100) _GUICtrlListView_SetColumnWidth ($ListView, 1, 100) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($ListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlCreateListViewItem("Name 1|Category 1", $ListView) GUICtrlCreateListViewItem("Name 2|Category 2", $ListView) screenshotWidgetInit($ssW,$ssH, 690, 100) GUISetState(@SW_SHOW, $mainWindow) GUIRegisterMsg($WM_NOTIFY, "WM_Notify_Events") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _Exit() EndSwitch WEnd Func Test() For $k = 1 To UBound($aFiles) - 1 screenshotWidgetTransition($aFiles[$k]) Next EndFunc Func ListView_Click() ConsoleWrite("Left Click") EndFunc Func ListView_DoubleClick() ConsoleWrite("Double Left Click") Test() EndFunc Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tagNMHDR, $event, $hwndFrom, $code $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return $event = DllStructGetData($tagNMHDR, 3) Select Case $wParam = $ListView Select Case $event = $NM_CLICK ListView_Click () Case $event = $NM_DBLCLK ListView_DoubleClick () EndSelect EndSelect Return $GUI_RUNDEFMSG EndFunc Func screenshotWidgetTransition($image, $delay = 0, $speed = 1, $sleep = 2000) Local $a, $d = $c, $iX, $iY $ssImage = _GDIPlus_ImageLoadFromFile($image) $iX = _GDIPlus_ImageGetWidth($ssImage) $iY = _GDIPlus_ImageGetHeight($ssImage) $FDesktop=$ssH/$ssW $Fact =1 If $iX > $ssW And $FDesktop > ($iY/$iX) Then $Fact=$ssW/$iX ElseIf $iY > $ssH Then $Fact=$ssH/$iY EndIf $H1 = Round(($Fact * $iY),0) $W1 = Round(($Fact * $iX),0) _GDIPlus_GraphicsDrawImageRect($ssGraphic[$d], $ssImage,($ssW - $W1)/2, ($ssH - $H1) / 2,$W1,$H1) WinSetTrans($ssGDI[$d], "", 0) WinSetOnTop($ssGDI[$d], "", 1) For $a = 0 To 254 Step $speed WinSetTrans($ssGDI[$d], "", $a) Sleep($delay) Next WinSetTrans($ssGDI[$d], "", 254) WinSetOnTop($ssGDI[Not ($d)], "", 0) WinSetTrans($ssGDI[Not ($d)], "", 0) _GDIPlus_GraphicsClear($ssGraphic[Not ($d)]) $c = 1 - $d _GDIPlus_ImageDispose ($ssImage) ; very important to realease the pics Sleep($sleep) EndFunc ;==>screenshotWidgetTransition Func screenshotWidgetInit($ssW,$ssH,$ssX,$ssY) $ssGDI[2] = GUICreate("", $ssW, $ssH, $ssX, $ssY, $WS_POPUP, $WS_EX_MDICHILD, $mainWindow) $ssGDI[0] = GUICreate("", $ssW, $ssH, 3, 3, $WS_POPUP, $WS_EX_MDICHILD, $ssGDI[2]) $ssGDI[1] = GUICreate("", $ssW, $ssH, 3, 3, $WS_POPUP, $WS_EX_MDICHILD, $ssGDI[2]) ; GUISetBkColor("0x" & $bg_color, $ssGDI[2]) GUISetState(@SW_SHOW, $ssGDI[2]) GUISetState(@SW_SHOW, $ssGDI[0]) GUISetState(@SW_SHOW, $ssGDI[1]) WinSetTrans($ssGDI[0], "", 0) WinSetTrans($ssGDI[1], "", 0) _GDIPlus_Startup() $ssGraphic[0] = _GDIPlus_GraphicsCreateFromHWND($ssGDI[0]) $ssGraphic[1] = _GDIPlus_GraphicsCreateFromHWND($ssGDI[1]) _GDIPlus_GraphicsClear($ssGraphic[0], "0xFF" & $bg_color) _GDIPlus_GraphicsClear($ssGraphic[1], "0xFF" & $bg_color) EndFunc ;==>screenshotWidgetInit Func _Exit() _GDIPlus_ImageDispose($ssImage) _GDIPlus_GraphicsDispose($ssGraphic[0]) _GDIPlus_GraphicsDispose($ssGraphic[1]) GUIDelete($ssGDI[0]) GUIDelete($ssGDI[1]) GUIDelete($ssGDI[2]) _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit I hope someone can shed light on this; perhaps a different approach is needed?
      Thank you in advance!
      P.S.
      The script is patched from different scripts of different users in the forum - thank you again users!