Jump to content

multie text search for text filter


Go to solution Solved by Melba23,

Recommended Posts

my text filter is almost complete what it still needs is a multie text search

Filter inbox Ex: file;win

now i want it to find items with the text file and win

this is func 1 next func what i need is a black list this meens when i enter a text in the black list box Ex: test

i want it to find items with the text file and win and NOT items with the text test

i have try to find a way i can not find it

maybe kylomas or M23 can help me out

PS: black list also need a multie search

and is it possible you can find a way that the scroll bar does not go back to the top when the list is updated with new items

it most not move when i get more then 20 items
+ if i select a item it wil be deselect when the list is updated

#include <WindowsConstants.au3>
#include <GuiListBox.au3>
#include <EditConstants.au3>
#Include <File.au3>
#NoTrayIcon

Opt("GUICoordMode", 1)
Global $iCurrIndex = -1, $sFile=@ScriptDir & "\File List.txt", $FileSize=0

Global $hGUI = GUICreate("Test Windows", 175, 460, 200, 200)
GUICtrlCreateLabel("Filter", 7, 5)
Global $hInput = GUICtrlCreateInput("", 5, 20, 165, 25)
GUICtrlCreateLabel("Black List", 7, 50)
Global $hBlacklist = GUICtrlCreateInput("", 5, 65, 165, 25)
Global $hList = GUICtrlCreateList("", 5, 95, 165, 330, BitOr($WS_VSCROLL, $LBS_DISABLENOSCROLL))
Global $hButton = GUICtrlCreateButton("Exit", 5, 430, 165, 25)
Global $hClear = GUICtrlCreateButton("Clear", 90, 1, 80, 19)
GUICtrlSetFont($hInput, 11, 600, "", "Tahoma")
GUICtrlSetColor($hInput, 0x948064)
GUICtrlSetBkColor($hInput, 0x000000)
GUICtrlSetFont($hList, 11, 600, "", "Tahoma")
GUICtrlSetBkColor($hList, 0x000000)
GUICtrlSetColor($hList, 0x948064)
GUISetStyle($WS_CAPTION, $WS_BORDER)
Global $hUP = GUICtrlCreateDummy()
Global $hDOWN = GUICtrlCreateDummy()
Global $hENTER = GUICtrlCreateDummy()
GUISetState(@SW_SHOW, $hGUI)

GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND')
Global $aKeyWords = StringSplit(FileRead($sFile), @CRLF, 3)
Keywords(GUICtrlRead($hInput))

Dim $AccelKeys[3][2] = [["{UP}", $hUP], ["{DOWN}", $hDOWN], ["{ENTER}", $hENTER]]
GUISetAccelerators($AccelKeys)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            Exit
        Case $hClear
            Keywords(GUICtrlRead($hInput))
            $FileSize=0
            $aKeyWords = ""
            FileRecycle($sFile)
        Case $hUP
            $iCurrIndex -= 1
            If $iCurrIndex < 0 Then $iCurrIndex = 0
            _GUICtrlListBox_SetCurSel($hList, $iCurrIndex)
        Case $hDOWN
            $iTotal = _GUICtrlListBox_GetCount($hList)
            $iCurrIndex += 1
            If $iCurrIndex > $iTotal - 1 Then $iCurrIndex = $iTotal - 1
            _GUICtrlListBox_SetCurSel($hList, $iCurrIndex)
        Case $hENTER
            If $iCurrIndex <> -1 Then
                $sText = _GUICtrlListBox_GetText($hList, $iCurrIndex)
                GUICtrlSetData($hInput, $sText)
                $iCurrIndex = -1
                _GUICtrlListBox_SetCurSel($hList, $iCurrIndex)
            EndIf
    EndSwitch
    If Not FileExists($sFile) Then
        $aKeyWords = ""
        $FileSize=0
        Keywords(GUICtrlRead($hInput))
        GUICtrlSetData($hList, 'Waiting For:|File List')
        While Not FileExists($sFile)
            Switch GUIGetMsg()
                 Case $GUI_EVENT_CLOSE
                    Exit
                Case $hButton
                    Exit
            EndSwitch
        WEnd
        $aKeyWords = StringSplit(FileRead($sFile), @CRLF, 3)
        Keywords(GUICtrlRead($hInput))
        $FileSize = FileGetSize($sFile)
    ElseIf Not (FileGetSize($sFile) = $FileSize) Then
        $aKeyWords = StringSplit(FileRead($sFile), @CRLF, 3)
        $FileSize = FileGetSize($sFile)
        Keywords(GUICtrlRead(StringSplit(FileRead($sFile), ";", 3)))
    EndIf
    Sleep(0.5)
WEnd

Func _DubbleClick()
    Msgbox(64,"Dubble Click","Dubble Click Func!")
EndFunc
Func Keywords($sFilter)

    Local $shlist = '|'
    For $1 = 0 To UBound($aKeyWords) - 2
        If $sFilter = '' Then
            $shlist &= $aKeyWords[$1] & '|'
            ContinueLoop
        Else
            If StringInStr($aKeyWords[$1], $sFilter) > 0 Then $shlist &= $aKeyWords[$1] & '|'
        EndIf
    Next

    GUICtrlSetData($hList, $shlist)

EndFunc

Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
    If FileExists($sFile) Then
        Switch BitAND($wParam, 0xFFFF)
            Case $hInput or $hList
                Switch BitShift($wParam, 16)
                    Case $EN_CHANGE
                        Keywords(GUICtrlRead($hInput))
                    Case 2
                        _DubbleClick()
                EndSwitch
        EndSwitch
        Return $GUI_RUNDEFMSG
    EndIf
EndFunc

File list contains:

File-01

win2

win3

test1

Edited by Merchants
Link to comment
Share on other sites

  • Moderators

Merchants,

How is this? ;)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StringConstants.au3>
#include <GuiListBox.au3>
#include <EditConstants.au3>
#include <File.au3>

Opt("GUICoordMode", 1)

Global $iCurrIndex = -1
Global $sFile = @ScriptDir & "\File_List.txt"

; A flag for doubleclicks
Global $fDblClick = False

Global $hGUI = GUICreate("Test Windows", 175, 460, 200, 200)

GUICtrlCreateLabel("Filter", 7, 5)
Global $cWhiteList = GUICtrlCreateInput("", 5, 20, 165, 25)
GUICtrlCreateLabel("Black List", 7, 50)
Global $cBlacklist = GUICtrlCreateInput("", 5, 65, 165, 25)
Global $cList = GUICtrlCreateList("", 5, 95, 165, 330, BitOR($WS_VSCROLL, $LBS_DISABLENOSCROLL))
Global $cExit = GUICtrlCreateButton("Exit", 5, 430, 165, 25)
Global $cClear = GUICtrlCreateButton("Clear", 90, 1, 80, 19)

Global $cUP = GUICtrlCreateDummy()
Global $cDOWN = GUICtrlCreateDummy()
Global $cENTER = GUICtrlCreateDummy()

GUISetState(@SW_SHOW, $hGUI)

GUIRegisterMsg($WM_COMMAND, '_WM_COMMAND')

Global $iPrevFileSize = FileGetSize($sFile)
Global $aLines
_FileReadToArray($sFile, $aLines)
$sData = _SearchLines()
GUICtrlSetData($cList, $sData)

Dim $AccelKeys[3][2] = [["{UP}", $cUP], ["{DOWN}", $cDOWN], ["{ENTER}", $cENTER]]
GUISetAccelerators($AccelKeys)

$nBegin = TimerInit()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $cExit
            Exit
        Case $cClear
            GUICtrlSetData($cList, "")
        Case $cUP
            $iCurrIndex -= 1
            If $iCurrIndex < 0 Then $iCurrIndex = 0
            _GUICtrlListBox_SetCurSel($cList, $iCurrIndex)
        Case $cDOWN
            $iTotal = _GUICtrlListBox_GetCount($cList)
            $iCurrIndex += 1
            If $iCurrIndex > $iTotal - 1 Then $iCurrIndex = $iTotal - 1
            _GUICtrlListBox_SetCurSel($cList, $iCurrIndex)
        Case $cENTER
            If $iCurrIndex <> -1 Then
                $sText = _GUICtrlListBox_GetText($cList, $iCurrIndex)
                GUICtrlSetData($cWhiteList, $sText)
                $iCurrIndex = -1
                _GUICtrlListBox_SetCurSel($cList, $iCurrIndex)
            EndIf
    EndSwitch

    ; Look for file size change every 5 secs
    If TimerDiff($nBegin) > 5000 Then
        $iFileSize = FileGetSize($sFile)
        If $iFileSize <> $iPrevFileSize Then
            ; If size changed than reload contents
            $iPrevFileSize = $iFileSize
            _FileReadToArray($sFile, $aLines)
            GUICtrlSetData($cList, _SearchLines())
        EndIf
    EndIf

    ; Look for doubleclick flag
    If $fDblClick Then
        ; Clear flag
        $fDblClick = False
        ; Run function
        _DblClick()
    EndIf

WEnd

Func _SearchLines()

    ; Read WhiteList input and create an array - assumes comma separated inputs
    $sWhiteList = StringStripWS(GUICtrlRead($cWhiteList), $STR_STRIPALL)
    If $sWhiteList == "" Then
        Global $aWhiteList[1] = [0]
    Else
        $aWhiteList = StringSplit($sWhiteList, ",")
    EndIf
    ; Now the same for the BlackList
    $sBlackList = StringStripWS(GUICtrlRead($cBlacklist), $STR_STRIPALL)
    If $sBlackList == "" Then
        Global $aBlackList[1] = [0]
    Else
        $aBlackList = StringSplit($sBlackList, ",")
    EndIf

    If GUICtrlRead($cWhiteList) & GUICtrlRead($cBlacklist) == "" Then
        ; If no entries in either list then just return the full array
        Return "|" & _ArrayToString($aLines, "|" , 1)
    Else
        ; Start checking
        $sRet = ""
        ; Loop through entries
        For $i = 1 To $aLines[0]
            ; Set a flag to show if all WhiteList elements were found
            $iFilter = 0
            $sLine = StringLower($aLines[$i])
            ; Compare entry to all Whitellist elements
            For $j = 1 To $aWhiteList[0]
                If StringInStr($sLine, StringLower($aWhiteList[$j])) Then
                    ; Increase counter flag if found
                    $iFilter += 1
                EndIf
            Next
            ; If all WhiteList elements were found
            If $iFilter = $aWhiteList[0] Then
                ; Start checking for BlackList elements
                For $j = 1 To $aBlackList[0]
                    If StringInStr($sLine, $aBlackList[$j]) Then
                        ; if a Blacklist  found set coutn flag to 0
                        $iFilter = 0
                        ; no point in looking further
                        ExitLoop
                    EndIf
                Next
            EndIf
            ; If count flag is still valid
            If $iFilter = $aWhiteList[0] Then
                ; Add entry to return list
                $sRet &= "|" & $aLines[$i]
            EndIf
        Next

        ; Return list of matched entries
        Return $sRet

    EndIf

EndFunc   ;==>_SearchLines

Func _DblClick()
    MsgBox(64, "DblClick", "DblClick Func!")
EndFunc   ;==>_DblClick

Func _WM_COMMAND($cWnd, $iMsg, $wParam, $lParam)
    $cCID = BitAND($wParam, 0xFFFF)
    $iCode = BitShift($wParam, 16)
    Switch $cCID
        Case $cWhiteList, $cBlacklist
            Switch $iCode
                Case $EN_CHANGE
                    GUICtrlSetData($cList, _SearchLines())
            EndSwitch
        Case $cList
            Switch $iCode
                Case $LBN_DBLCLK
                    $fDblClick = True
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND
Please ask if anything is unclear or does not work as you wish. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

Merchants,

That code is written for 3.3.12.0 - which version of AutoIt are you running? :huh:

If it is not the latest, why not update your installation? But if you do not want to update at the moment, just change the 2 instances of $STR_STRIPALL to 8 and delete the #include <StringConstants> line. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

ok not bad there is still a lot to be done

File list contains:

test1

test2

bla1

bla2

 

first: when i type in the filter box: test,bla

it does not show any of the items anymore

(it looks like to do a multi search just type it like: <text>comma<text> am i right?)

second: if i leave the filter box blank and i enter: bla in the black list box it does not do anything

there is more but al do 2 things at a time or if you like to hear it all just say it

Edited by Merchants
Link to comment
Share on other sites

  • Moderators

Merchants,

 

ok not bad

Why thank you. :whistle:

there is still a lot to be done

Best you get on with it then. :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators
  • Solution

Merchants,

You asked to "find items with the text file and win" - so "test,bla" will not match because no entry contains "bla". If you meant "or" (i.e. any of the Whitelist items) then this amended function is probably what you need:

Func _SearchLines()

    ; Read WhiteList input and create an array - assumes comma separated inputs
    $sWhiteList = StringStripWS(GUICtrlRead($cWhiteList), $STR_STRIPALL)
    If $sWhiteList <> "" Then
        $sWhiteList = StringReplace($sWhiteList, ",", "|")
    EndIf

    ; Now the same for the BlackList
    $sBlackList = StringStripWS(GUICtrlRead($cBlacklist), $STR_STRIPALL)
    If $sBlackList <> "" Then
        $sBlackList = StringReplace($sBlackList, ",", "|")
    EndIf

    If GUICtrlRead($cWhiteList) & GUICtrlRead($cBlacklist) == "" Then
        ; If no entries in either list then just return the full array
        Return "|" & _ArrayToString($aLines, "|" , 1)
    Else
        ; Start checking
        $sRet = ""
        ; Loop through entries
        For $i = 1 To $aLines[0]
            $iFilter = 0
            If $sWhiteList = "" Then $iFilter = 1
            ; Compare entry to all Whitelist elements
            If StringRegExp($aLines[$i], "(?i)[" & $sWhiteList & "]") Then
                $iFilter = 1
            EndIf
            ; If a WhiteList element were found
            If $iFilter And $sBlackList <> "" Then
                ; Check for BlackList elements
                If StringRegExp($aLines[$i], "(?i)[" & $sBlackList & "]") Then
                    $iFilter = 0
                EndIf
            EndIf
            ; If count flag is still valid
            If $iFilter Then
                ; Add entry to return list
                $sRet &= "|" & $aLines[$i]
            EndIf
        Next
        ; Return list of matched entries
        Return $sRet

    EndIf

EndFunc   ;==>_SearchLines
And I fixed a few more bugs as well. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

i find this better  :thumbsup:
StringRegExp($aLines[$i], "(?i)" & $sWhiteList)
StringRegExp($aLines[$i], "(?i)" & $sBlackList)

the multi text search is complete i thank you for that :thumbsup:

so next 2 things:

first:

File list contains:

more than 30 random items (text)

the file list update every 5 sec with more items

ok my list is now bigger then i can see. So i need to scroll down. I scroll down half way

next my list wil update with new and more items this as result that my scroll bar wil move to the top i find this very annoying

the scroll bar needs to go back where it left off once the list is done updating

second:

if i select a item by doning 1 click on it this wil be deselect when the list is updated

Edited by Merchants
Link to comment
Share on other sites

  • Moderators

Merchants,

Would Sir like fries with that? Time for you to do some work for a change - have you even looked in the Help file to see if anything there might be any functions that could help? :P

- Scrolling list to a given point:

Read the index of the currently selected item using _GUICtrlListBox_GetCaretIndex - when the update is finished, set the top index of the list to that value minus a few (use _SendMessage & $LB_SETTOPINDEX) so that the previously selected item is part way down.

- Unselecting currently selected item:

Use _GUICtrlListBox_SetCurSel - the Help file tells you what parameters to set.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Unselecting currently selected item: Fixed

Scrolling list to a given point:

i have tryed to deal with this on google + help files i can't find a way to fix this

i have no id how to deal with _SendMessage and i am very curious what where you come up with

Link to comment
Share on other sites

  • Moderators

Merchants,

And what have you tried over the past few days? Or are you just expecting someone to provide code for you? :huh:

In fact I found an easier way to do it:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListBox.au3>

$hGUI = GUICreate("Test", 500, 500)

Local $cList = GUICtrlCreateList("", 10, 10, 400, 200, BitOR($WS_VSCROLL, $WS_BORDER))
For $i = 1 To 50
    GUICtrlSetData($cList, "Item " & $i)
    _GUICtrlListBox_SetSel($cList, $i-1)
Next
_GUICtrlListBox_SetTopIndex($cList, 0))

$cButton = GUICtrlCreateButton("Reload", 10, 450, 80, 30)

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cButton
            ; Get selected index
            $iIndex = _GUICtrlListBox_GetCaretIndex($cList)
            ; Make sure it will not be negative
            If $iIndex < 10 Then $iIndex = 10
            ; Set top index to the selected item - 10 so selection is in middle of list
            _GUICtrlListBox_SetTopIndex($cList, $iIndex - 10)
    EndSwitch
WEnd
Select an item and scroll way from it - pressing the button brings it back into view. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

when i fist saw this _GUICtrlListBox_SetTopIndex($clist) i also find this: _GUICtrlListBox_GetTopIndex($clist)

i finally found out how to get the index of the scroll bar and so it runs smoothly now with the new updates:

Thank you M23

; Look for file size change every 5 secs
If TimerDiff($nBegin) > 5000 Then
    $iFileSize = FileGetSize($sFile)
    If $iFileSize <> $iPrevFileSize Then
        ; If size changed than reload contents
        _GUICtrlListBox_BeginUpdate($cList)
        $iPrevIndex = _GUICtrlListBox_GetCaretIndex($cList)
        $iPrevposition = _GUICtrlListBox_GetTopIndex($cList)
        $iPrevFileSize = $iFileSize
        _FileReadToArray($sFile, $aLines)
        GUICtrlSetData($cList, _SearchLines())
        _GUICtrlListBox_SetCurSel($cList, $iPrevIndex)
        _GUICtrlListBox_SetTopIndex($cList, $iPrevposition)
        _GUICtrlListBox_EndUpdate($cList)
    EndIf
EndIf
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...