Wingens

Read ini file and fill listview

16 posts in this topic

#1 ·  Posted

Hi,

 

I am trying to create a list view wich shows the content of an ini file. There is a pulldown menu wich allows me to check a certain status in the ini file if the status is found it should read out the key and in every section the same key is located after that it should fill out the listview with all results found.

 

$OVERZICHTGUI = GUICreate("RMA Overzicht", 1235, 742, -1, -1)

    GUICtrlCreateLabel("Ingelogd als: " & $NAAMMEDEWERKER, 8, 0)
            GUICtrlSetState(-1, $GUI_DISABLE)

    GUICtrlCreateGroup("", 8, 16, 185, 89)
        GUICtrlCreateLabel("Status:", 32, 40, 37, 17)
            $STATUS = GUICtrlCreateCombo("", 32, 64, 140, 25,BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
                GUICtrlSetData($STATUS, "Aangevraagd|Verzonden|Afgehandeld", "")
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    $View = GUICtrlCreateListView("RMANR|RMANRLEV|DEBITNR|KLANT|STATUS|MODEL|SERIENR|AANGEMELDDOOR|AANMELDDATUM|VERZENDDATUM|RETOURDATUM|KLACHT|OPLOSSING", 8, 120, 1218, 614)

    $Exit = GUICtrlCreateButton("Hoofdmenu", 1104, 8, 123, 33)
        GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

    GUISetState(@SW_SHOW)


    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $EXIT
                $YesOrNo = msgBox(4,"","Terug naar het hoofdmenu?")
                    If $YesOrNo = 6 then
                        GUIDelete($OVERZICHTGUI)
                        MAINMENU()
                        ExitLoop
                    EndIf
            Case $STATUS
                $GO = 1
                $STATE = GUICtrlRead($STATUS)
                Local $aArray = IniReadSection(@ScriptDir & "\DB\rma.ini", "STATUS")
                            _ArrayDisplay($aArray, "Gevonden")
                            $FOUNDRMANR = _ArraySearch($aArray, $STATE)
                            MsgBox(4096, "", $FOUNDRMANR)
                            If $FOUNDRMANR = -1 Then
                                MsgBox(4096, "Not Found", "No RMA requests with this status found.")
                                $GO = 0
                            EndIf
                            If $GO = 1 Then
                                $VAR = IniRead(@ScriptDir & "\DB\rma.ini", "RMANR", $FOUNDRMANR, "Not found")
                                    MsgBox(4096, "", $VAR)
                            EndIf
        EndSwitch
    WEnd

 

rma-forum.ini

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I am trying to run your script but getting error as below.

assa.PNG

Please share te MAINMENU() also.

 

Edited by ur

Share this post


Link to post
Share on other sites

#3 ·  Posted

Had the same issue as UR, however here is how I would do it:

#include <Array.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>

FNC_RMAGUI()

Func FNC_RMAGUI()
    Local $hINI_FILENAME = @ScriptDir & "\DB\rma.ini"
    Local $aINI_SECTIONS[13] = ['RMANR', 'RMANRLEV', 'DEBITNR', 'KLANT', 'STATUS', 'MODEL', 'SERIENR', 'AANGEMELDDOOR', 'AANMELDDATUM', 'VERZENDDATUM', 'RETOURDATUM', 'KLACHT', 'OPLOSSING'] ;~ Sections that should be read from Ini and added to ListView, also used as ListView Header
    Local $aOptions = IniReadSection($hINI_FILENAME, 'Options') ;~ Use the Options section to populate the ComboBox
    Local $NAAMMEDEWERKER = 'NAAMEDWERKER' ;~ Remove this

    $OVERZICHTGUI = GUICreate("RMA Overzicht", 1235, 742, -1, -1)

        GUICtrlCreateLabel("Ingelogd als: " & $NAAMMEDEWERKER, 8, 0)
                GUICtrlSetState(-1, $GUI_DISABLE)

        GUICtrlCreateGroup("", 8, 16, 185, 89)
            GUICtrlCreateLabel("Status:", 32, 40, 37, 17)
                $STATUS = GUICtrlCreateCombo("", 32, 64, 140, 25,BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
                    GUICtrlSetData($STATUS, _ArrayToString($aOptions, '|', 1, -1, '|', 0, 0), "")
        GUICtrlCreateGroup("", -99, -99, 1, 1)

        $hGUI_LISTVIEW = GUICtrlCreateListView(_ArrayToString($aINI_SECTIONS), 8, 120, 1218, 614)

        $Exit = GUICtrlCreateButton("Hoofdmenu", 1104, 8, 123, 33)
            GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

        GUISetState(@SW_SHOW)

        While 1
            $nMsg = GUIGetMsg()
            Switch $nMsg
                Case $GUI_EVENT_CLOSE
                Exit
                Case $EXIT
                    $YesOrNo = msgBox(4,"","Terug naar het hoofdmenu?")
                        If $YesOrNo = 6 then
                            GUIDelete($OVERZICHTGUI)
                           ; MAINMENU() ;~ Commented for test purposes
                            ExitLoop
                        EndIf
                Case $STATUS
                    $STATE = GUICtrlRead($STATUS)
                    Local $sSTATUS = IniRead($hINI_FILENAME, 'Options', $STATE, 'Not Found')
                    If $sSTATUS <> 'Not Found' Then
                        _GUICtrlListView_DeleteAllItems($hGUI_LISTVIEW) ;~ Remove this if you just want to append the data to the ListView without removing all items
                        $sListViewItem = ''
                        For $x = 0 To UBound($aINI_SECTIONS) - 1
                            If $x = UBound($aINI_SECTIONS) - 1 Then
                                $sListViewItem &= IniRead($hINI_FILENAME, $aINI_SECTIONS[$x], $sSTATUS, -1)
                                ExitLoop
                            EndIf
                            $sListViewItem &= IniRead($hINI_FILENAME, $aINI_SECTIONS[$x], $sSTATUS, -1) & '|'
                        Next
                        GUICtrlCreateListViewItem($sListViewItem, $hGUI_LISTVIEW)
                    EndIf
            EndSwitch
        WEnd
EndFunc

In your Ini file add the following:

[Options]
Afgehandeld=1
Verzonden=3
Aangevraagd=4

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@Subz

The script is working only problem is, when there are multiple entries in the ini file using the same status it only shows 1 result in the listview.

Any idea's on this?

Edited by Wingens

Share this post


Link to post
Share on other sites

#5 ·  Posted

Can you re-post the ini file with multiple entries, I'm not really sure what you mean by "when there are multiple entries in the ini file using the same status it only shows 1 result in the listview."

Currently how the script works is when you select an option for example: "Verzonden" in the ComboBox it gets the status id from [Options] - Verzonden so the result is "3", it then reads each section referenced in $aINI_SECTIONS with the Ini Key "3".  Ini Keys should be unique in each section, as IniRead will only pick up 1 key.  You could add multiple keys and use IniReadSection but I wouldn't recommend it as it will cause more problems especially if the keys are not written in the correct order.

Can you confirm that is what you're referring to or is it something else?

 

Share this post


Link to post
Share on other sites

#6 ·  Posted

Every RMA request gets an unique ID

Example:

[STATUS]
1=Afgehandeld
3=Aangevraagd
4=Aangevraagd
5=Aangevraagd

ID 3,4 and 5 have the same status, when i choose the status: Aangevraagd it show in the listview only ID: 4 instead of 3,4 and 5. Hope this helps.

v0.2.au3

rma.ini

medewerker.ini

Share this post


Link to post
Share on other sites

#7 ·  Posted

Think I understand now, can you try this:

NB: You can remove Options Section from the Ini as its no longer required.

Func OVERZICHT()
    Local $hINI_FILENAME = @ScriptDir & "\DB\rma.ini"
    Local $aINI_SECTIONS[13] = ['RMANR', 'RMANRLEV', 'DEBITNR', 'KLANT', 'STATUS', 'MODEL', 'SERIENR', 'AANGEMELDDOOR', 'AANMELDDATUM', 'VERZENDDATUM', 'RETOURDATUM', 'KLACHT', 'OPLOSSING'] ;~ Sections that should be read from Ini and added to ListView, also used as ListView Header
    Local $aSTATUS_SECTION = IniReadSection($hINI_FILENAME, 'STATUS') ;~ Use the Options section to populate the ComboBox
    Local $aSTATUS_ITEMS[0]

    $OVERZICHTGUI = GUICreate("RMA Overzicht", 1235, 742, -1, -1)

        GUICtrlCreateLabel("Ingelogd als: " & $NAAMMEDEWERKER, 8, 0)
            GUICtrlSetState(-1, $GUI_DISABLE)

        GUICtrlCreateGroup("", 8, 16, 185, 89)
            GUICtrlCreateLabel("Status:", 32, 40, 37, 17)
                $STATUS = GUICtrlCreateCombo("", 32, 64, 140, 25,BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
                    GUICtrlSetData($STATUS, _ArrayToString(_ArrayUnique($aSTATUS_SECTION, 1), '|', 1, -1, '|', 1, 1), "")
        GUICtrlCreateGroup("", -99, -99, 1, 1)

        $hGUI_LISTVIEW = GUICtrlCreateListView(_ArrayToString($aINI_SECTIONS), 8, 120, 1218, 614)

        $Exit = GUICtrlCreateButton("Hoofdmenu", 1104, 8, 123, 33)
            GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

        GUISetState(@SW_SHOW)

        While 1
            $nMsg = GUIGetMsg()
            Switch $nMsg
                Case $GUI_EVENT_CLOSE
                Exit
                Case $EXIT
                    $YesOrNo = msgBox(4,"","Terug naar het hoofdmenu?")
                        If $YesOrNo = 6 then
                            GUIDelete($OVERZICHTGUI)
                           MAINMENU()
                            ExitLoop
                        EndIf
                Case $STATUS
                    $STATE = GUICtrlRead($STATUS)
                    $aSTATUS_INDEX = _ArrayFindAll($aSTATUS_SECTION, $STATE, 1, 0, 0, 0, 1)
                    ReDim $aSTATUS_ITEMS[UBound($aSTATUS_INDEX)]
                    For $i = 0 To UBound($aSTATUS_INDEX) - 1
                        $aSTATUS_ITEMS[$i] = $aSTATUS_SECTION[$aSTATUS_INDEX[$i]][0]
                    Next
                    If IsArray($aSTATUS_ITEMS) Then
                        _GUICtrlListView_DeleteAllItems($hGUI_LISTVIEW) ;~ Remove this if you just want to append the data to the ListView without removing all items
                        For $i = 0 To UBound($aSTATUS_ITEMS) - 1
                            $sListViewItem = ''
                            For $j = 0 To UBound($aINI_SECTIONS) - 1
                                If $j = UBound($aINI_SECTIONS) - 1 Then
                                    $sListViewItem &= IniRead($hINI_FILENAME, $aINI_SECTIONS[$j], $aSTATUS_ITEMS[$i], -1)
                                    ExitLoop
                                EndIf
                                $sListViewItem &= IniRead($hINI_FILENAME, $aINI_SECTIONS[$j], $aSTATUS_ITEMS[$i], -1) & '|'
                            Next
                            GUICtrlCreateListViewItem($sListViewItem, $hGUI_LISTVIEW)
                        Next
                    EndIf
            EndSwitch
        WEnd
EndFunc

 

Share this post


Link to post
Share on other sites

#8 ·  Posted

The scripts crashed with this in the console:

 

"C:\Program Files (x86)\AutoIt3\Include\Array.au3" (2297) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
If IsInt($aArray[$iBase]) Then
If IsInt(^ ERROR

Share this post


Link to post
Share on other sites

#9 ·  Posted

Using the script + ini from Post#7 changing only the OVERZICHT function, I can't get it to crash, have you updated the Ini or the script?

Share this post


Link to post
Share on other sites

#11 ·  Posted

Sorry still can't get it to crash, however looking at Array.au3 line 2297 indicates it's related to _ArrayUnique not sure if the issue is because it's used within _ArrayToString so split it up, can you try:

Func OVERZICHT()
    Local $hINI_FILENAME = @ScriptDir & "\DB\rma.ini"
    Local $aINI_SECTIONS[13] = ['RMANR', 'RMANRLEV', 'DEBITNR', 'KLANT', 'STATUS', 'MODEL', 'SERIENR', 'AANGEMELDDOOR', 'AANMELDDATUM', 'VERZENDDATUM', 'RETOURDATUM', 'KLACHT', 'OPLOSSING'] ;~ Sections that should be read from Ini and added to ListView, also used as ListView Header
    Local $aSTATUS_SECTION = IniReadSection($hINI_FILENAME, 'STATUS') ;~ Use the Options section to populate the ComboBox
    Local $sSTATUS_SECTION = _ArrayUnique($aSTATUS_SECTION, 1)
        $sSTATUS_SECTION = _ArrayToString($sSTATUS_SECTION, '|', 1, -1, '|', 1, 1)
    Local $aSTATUS_ITEMS[0]

    $OVERZICHTGUI = GUICreate("RMA Overzicht", 1235, 742, -1, -1)

        GUICtrlCreateLabel("Ingelogd als: " & $NAAMMEDEWERKER, 8, 0)
            GUICtrlSetState(-1, $GUI_DISABLE)

        GUICtrlCreateGroup("", 8, 16, 185, 89)
            GUICtrlCreateLabel("Status:", 32, 40, 37, 17)
                $STATUS = GUICtrlCreateCombo("", 32, 64, 140, 25,BitOR($CBS_DROPDOWNLIST, $WS_VSCROLL))
                    GUICtrlSetData($STATUS, $sSTATUS_SECTION, "")
        GUICtrlCreateGroup("", -99, -99, 1, 1)

        $hGUI_LISTVIEW = GUICtrlCreateListView(_ArrayToString($aINI_SECTIONS), 8, 120, 1218, 614)

        $Exit = GUICtrlCreateButton("Hoofdmenu", 1104, 8, 123, 33)
            GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")

        GUISetState(@SW_SHOW)

        While 1
            $nMsg = GUIGetMsg()
            Switch $nMsg
                Case $GUI_EVENT_CLOSE
                Exit
                Case $EXIT
                    $YesOrNo = msgBox(4,"","Terug naar het hoofdmenu?")
                        If $YesOrNo = 6 then
                            GUIDelete($OVERZICHTGUI)
                           MAINMENU()
                            ExitLoop
                        EndIf
                Case $STATUS
                    $STATE = GUICtrlRead($STATUS)
                    $aSTATUS_INDEX = _ArrayFindAll($aSTATUS_SECTION, $STATE, 1, 0, 0, 0, 1)
                    ReDim $aSTATUS_ITEMS[UBound($aSTATUS_INDEX)]
                    For $i = 0 To UBound($aSTATUS_INDEX) - 1
                        $aSTATUS_ITEMS[$i] = $aSTATUS_SECTION[$aSTATUS_INDEX[$i]][0]
                    Next
                    If IsArray($aSTATUS_ITEMS) Then
                        _GUICtrlListView_DeleteAllItems($hGUI_LISTVIEW) ;~ Remove this if you just want to append the data to the ListView without removing all items
                        For $i = 0 To UBound($aSTATUS_ITEMS) - 1
                            $sListViewItem = ''
                            For $j = 0 To UBound($aINI_SECTIONS) - 1
                                If $j = UBound($aINI_SECTIONS) - 1 Then
                                    $sListViewItem &= IniRead($hINI_FILENAME, $aINI_SECTIONS[$j], $aSTATUS_ITEMS[$i], -1)
                                    ExitLoop
                                EndIf
                                $sListViewItem &= IniRead($hINI_FILENAME, $aINI_SECTIONS[$j], $aSTATUS_ITEMS[$i], -1) & '|'
                            Next
                            GUICtrlCreateListViewItem($sListViewItem, $hGUI_LISTVIEW)
                        Next
                    EndIf
            EndSwitch
        WEnd
EndFunc

 

Share this post


Link to post
Share on other sites

#14 ·  Posted

Ah damn that was it! thank you so much.

Share this post


Link to post
Share on other sites

#15 ·  Posted

@Wingens,

Hope you've tried using an Array with _FileReadToArray() and then loop it though the ini file to add them as line at the time with GUICtrlCreateListViewItem().

You can use $GUI_HIDE and $GUI_SHOW to filter GUICtrlCreateListViewItem()

GUICtrlSetState($listview1, $GUI_HIDE) - ;to hide ID's
 GUICtrlSetState($listview2, $GUI_SHOW) - ;to show desired ID

Just trying if it make sense. :)

Share this post


Link to post
Share on other sites

#16 ·  Posted

I wasn't able to check on your response. Good, hope it worked perfectly.

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

    • ercicttech
      By ercicttech
      Hello, all..

      My AutoIT is pretty terrible - but I get by with trawling here
      I came across an issue where i had to parse a large key in a large ini file, and found that I was victim of inireadsection's limit of "Only the first 32767 chars are read for legacy reasons."
       
      I've attempted to put together some terrible code that parses an ini section.
      It's absolutely nowhere near good, but I figured I'd put it here so that folk who know what they're doing can laugh at improve it.
      $Ini = @ScriptDir & "\bigini.ini" Dim $IniArray[0][2] $KeyName = "Person" $R = FileOpen($Ini, 0) $IniStr = FileRead($R) FileClose($R) $Start = StringInStr($iniStr, "[" & $KeyName & "]") If $Start = 0 then Msgbox(16, "Error", "String not found") Exit EndIf $Stop = StringInStr($IniStr, @CRLF & "[", 0, 1, ($Start + 1)) If $Stop = 0 then $Stop = StringLen($IniStr) EndIf $String = StringMid($IniStr, $Start, ($Stop - $Start)) $Split = StringSplit($String, @CRLF, 1) $KeyCount = 0 Dim $IniArray[65535][2] For $Loop = 1 to $Split[0] $Add = "Y" $Str = $Split[$Loop] $EQBreak = StringInStr($Str, "=") Select Case StringMid($Str, 1, 1) = ";" $Add = "N" Case $EQBreak = 0 $Add = "N" Case Else $Add = "Y" EndSelect If $Add = "Y" then $KeyCount = $KeyCount + 1 $Key = StringMid($Str, 1, ($EQBreak - 1)) $Val = StringMid($Str, ($EQBreak + 1)) $IniArray[$KeyCount][0] = $Key $IniArray[$KeyCount][1] = $Val EndIf Next Redim $IniArray[$KeyCount +1][2] ; Add the number of hits to 00 to match inireadsection $IniArray[0][0] = $KeyCount _ArrayDisplay($IniArray) ; Do stuff with the Array like you would inireadsection  
    • 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!
    • Daka
      By Daka
      I know there are listbox and listview, but now I have?
      here is the video of infowindow 
      I tried to read mouse selection like for listbox:
      $listWindow = "[CLASS:TFormResearchGR]" $topicsList = "[CLASS:TMWrapper; INSTANCE:255]" WinWait($listWindow, "", 60) $hdlWindow = WinGetHandle($listWindow) $hdlList = ControlGetHandle($hdlWindow, "", $topicsList) _GUICtrlListBox_ClickItem($hdlList, 0, "left") $countOfList = _GUICtrlListBox_GetCount($hdlList) ConsoleWrite("Count of list: " & $countOfList & @LF) count of list is not working.
      I realiezed that there are difference between listbox and listview, but this is something different.
      and till now I never saw that you can go inside with infotool and also get instances.
       
      so Im confused how to get the list number and the names of selection?