Jump to content

_FileListToArrayRec


gius
 Share

Recommended Posts

Hello everyone,
I apologize for English.
I am developing a small application
with which you can search  a word, and you have
the path of the file and the line where the search word.

The search for the word also includes subfolders with the function

  $ Afiles = _FileListToArrayRec ($ folders [$ k], "*" & $ ext, 1, 1, 0, 2)

but after a few minutes of searching the application terminates with a error:

Error Allocating memory

I can fix this error?

thank you

Link to comment
Share on other sites

  • Moderators

gius,

It could be that you are just finding too many files that match the filter. What are the $folders[$k] & $ext variable likely to be? :huh:

Try running the function to ever increasing depths of folder searching by setting the $iRecur to negative values - that way you limit the number of files found and can see if the function is at least finding some. ;)

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

Thanks Melba23 for the answer.

My code is this:

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
Global $folders[2] = [@DesktopDir, @MyDocumentsDir]
Local $ext[2] =  [".doc" , ".docx"]


Global $aResult[100000][2], $n = 0
Local $word = InputBox(" ", "Search: ", " ", "", _
            100, -1, 500, 300)
For $k = 0 to UBound($folders)-1    ; loop through folders
  $aFiles = _FileListToArrayRec($folders[$k], "*" & $ext, 1, 1, 0, 2)   ; list files
  If not @error Then
    For $i = 1 to $aFiles[0]   ; loop through files
       $content = FileRead($aFiles[$i])
       ; the following regex captures the full lines containing $word
       $res = StringRegExp($content, '(?im)(.*\b\Q' & $word & '\E\b.*)\R?', 3)  ; if $word must be a lone word
      ; $res = StringRegExp($content, '(?im)(.*\Q' & $word & '\E.*)\R?', 3)    ; if $word can be part of another word
        If IsArray($res) Then
            $aResult[$n][0] = $aFiles[$i]    ; file path
            For $j = 0 to UBound($res)-1
                $aResult[$n+$j][1] = $res[$j]    ; lines
            Next
            $n += $j
       EndIf
    Next
  EndIf
Next

Redim $aResult[$n][2]
_ArrayDisplay($aResult, "Test")

I believe that in this line ($ext) there is an error:

$aFiles = _FileListToArrayRec($folders[$k], "*" & $ext, 1, 1, 0, 2)

how can I fix this?

thank you

Link to comment
Share on other sites

  • Moderators

gius,

 

I believe that in this line ($ext) there is an error

Indeed there is - you are trying to pass an array as a filter. :(>

 

how can I fix this?

Change the code like this:

Global $folders[2] = [@DesktopDir, @MyDocumentsDir]
Local $sFilter =  "*.doc;*.docx" ; Create a string with the correct format for multiple filters <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Global $aResult[100000][2], $n = 0
Local $word = InputBox(" ", "Search: ", " ", "", 100, -1, 500, 300)
For $k = 0 to UBound($folders)-1    ; loop through folders
  $aFiles = _FileListToArrayRec($folders[$k], $sFilter, 1, 1, 0, 2) ; Use the filter to search <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
That certainly returns all the .doc/.docx files in those folders for me when I test. :)

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

Thanks again Melba23.

I wish only the file name and
I have tried to change

 $aFiles = _FileListToArrayRec($folders[$k], $sFilter, 1, 1, 0, 0)

$FLTAR_NOPATH (0) - File/folder name only

but does not work, Where I am wrong?

 

 

It is possible with the double clik on the row with the name of the file, open the folder where it is the file?

thank you

Link to comment
Share on other sites

  • Moderators

gius,

I have no idea why your code does not work - as I said, it works fine for me and returns all the files present. Try adding an _ArrayDisplay line after the _FileListToArray call to check that you are getting some files returned in the $aFiles array. Perhaps the reason for your empty final return is in the Regex part of the script, which I did not check at all. ;)

However, if you want to open the folder where a returned file is situated then I suggest that using the $FLTAR_NOPATH is not a good idea as you will have no idea of the path to open - I would stick with $FLTAR_FULLPATH so that you have something to work with. And you will not be able to doubleclick the _ArrayDisplay dialog to open the folder - although you could use the "user function" button to run a suitable function on the selected items. If you want to use a doubleclick then you will have to create your own dialog. ;)

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

Thanks again Melba23.

I'm sorry but my English is not good.
Your code works fine,
I wished to ask you if there can be only the name of the file is not the path of the file?
As for the click on the column and open the file,
you can kindly give me some other indication?

thank you

Link to comment
Share on other sites

  • Moderators

gius,

Delighted the basic code works. :)

Returning to the "click and open the folder" question, let me try and explain further. If you only return the filename there is no indication of the full path of the file - you have the $iRecur parameter set and so you could get returns from anywhere within the tree. And as you have 2 possible root folders, you cannot be sure of even the first few elements. That is why I suggested using $FLTAR_FULLPATH to make sure you can uniquely identify each returned file. ;)

Now as to how to open the folder. As I mentioned, doubleclicking within the _ArrayDisplay dialog will not work as the dialog is not set up to work that way. But you can select a file and then pass it to a pre-defined "user function" like this:

#include <Array.au3>
#include <File.au3>

; Get a list of files in the Windows folder
$aList = _FileListToArrayRec("C:\Windows", "*", $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH)

; Define the user function
Local $hUserFunction = _UserFunc
; And display the result - telling the UDF to use teh user function if required
_ArrayDisplay($aList, "Files returned", Default, 8, Default, Default, Default, Default, $hUserFunction)

; Now select a file in teh dialog and press the "Use User Func" button to run the function below

Func _UserFunc($aArray, $aSelected)

    ; Get first selected element
    $sFilePath = $aArray[$aSelected[1]]
    ; Remove the filename and just leave the folder path
    $sFolderPath = StringRegExpReplace($sFilePath, "(^.*)\\(.*)", "\1")
    ; Open the folder
    ShellExecute($sFolderPath)

EndFunc
I hope that is good enough. If not, we are into creating a dialog to display the files as a list and detecting which one has been double-clicked - not too difficult, but significantly more work. ;)

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

Since I was bored and this seemed like something I'd give a try at, here is the "dialog to display the files as a list and detecting which one has been double-clicked" described by Melba.

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstants.au3>
#include <GUIlistview.au3>

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

Global $folders[2] = [@DesktopDir, @MyDocumentsDir]
Local $sFilter =  "*.doc;*.docx", $listView

Global $aResult[100000][2], $n = 0
Local $msg, $word = InputBox(" ", "Search: ", " ", "", _
        100, -1, 500, 300)

For $k = 0 To UBound($folders) - 1 ; loop through folders
    $aFiles = _FileListToArrayRec($folders[$k], "*" & $sFilter, 1, 1, 0, 2) ; list files
    If Not @error Then
        For $i = 1 To $aFiles[0] ; loop through files
            $content = FileRead($aFiles[$i])
            ; the following regex captures the full lines containing $word
            $res = StringRegExp($content, '(?im)(.*\b\Q' & $word & '\E\b.*)\R?', 3) ; if $word must be a lone word
            ; $res = StringRegExp($content, '(?im)(.*\Q' & $word & '\E.*)\R?', 3)    ; if $word can be part of another word
            If IsArray($res) Then
                $aResult[$n][0] = $aFiles[$i] ; file path
                For $j = 0 To UBound($res) - 1
                    $aResult[$n + $j][1] = $res[$j] ; lines
                Next
                $n += $j
            EndIf
        Next
    EndIf
Next

ReDim $aResult[$n][2]
aGUI($aResult)

; keep us running
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

;=======================
; create the dialog
Func aGUI($array, $title = "display that array!")
    Local $gui, $i, $findStrPos, _
            $itemText, $replacedText, _
            $leftStr
    $gui = GUICreate($title, 800, 800)
    $listView = _GUICtrlListView_Create($gui, "Col0", 0, 0, 800, 800, BitOR($LVS_REPORT, $LVS_SINGLESEL))
    _GUICtrlListView_SetExtendedListViewStyle($listView, $LVS_EX_GRIDLINES)
    _GUICtrlListView_AddColumn($listView, "Col1")
    _GUICtrlListView_AddColumn($listView, "")
    _GUICtrlListView_AddArray($listView, $array)
    For $i = 0 To UBound($array) - 1 Step 1
        $itemText = _GUICtrlListView_GetItemText($listView, $i)
        If $itemText <> "" Then
            $findStrPos = StringInStr($itemText, "\", 0, -1)
            $leftStr = StringLeft($itemText, $findStrPos)
            $replacedText = StringReplace($itemText, $leftStr, "")
            _GUICtrlListView_SetItemText($listView, $i, $replacedText)
        EndIf
    Next
    _GUICtrlListView_SetColumnWidth($listView, 0, $LVSCW_AUTOSIZE_USEHEADER)
    _GUICtrlListView_SetColumnWidth($listView, 1, $LVSCW_AUTOSIZE_USEHEADER)
    GUISetState()
EndFunc   ;==>aGUI
;=======================


;=======================
; here is where we check for the Double click on the listview item
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, _
    $sIndices, $sData, $sAdata, $file, $splitFile
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $listView
            Switch $iCode
                Case $NM_DBLCLK
                    $sIndices = _GUICtrlListView_GetSelectedIndices($listView)
                    $sData = _GUICtrlListView_GetItemText($listView, $sIndices)
                    $sAdata = _ArraySearch($aResult, $sData, Default, Default, Default, 3)
                    $file = _ArrayToString($aResult, Default, $sAdata, 0, Default)
                    $splitFile = StringSplit($file, "|")
                    ShellExecute($splitFile[1])
            EndSwitch
    EndSwitch
EndFunc   ;==>WM_NOTIFY
;=======================

I hope both our solutions to your problem helps you understand how to go about this either way. :D

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Thanks Melba23,
really thank you,
I could not complete this line:

_ArrayDisplay(                , "Files returned", Default, 8, Default, Default, Default, Default, $hUserFunction)

What I have to insert?

Thanks MikahS
works fine with the editor,
but the antivirus does not make me compile the executable,

and if I disable the antivirus and compile it,
when I start the antivirus blocks it and deletes it,

how I can fix this?

thank you

Link to comment
Share on other sites

Anytime, what antivirus do you use?

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

  • Moderators

gius,

In your original script you need only change the final line:

; Old
_ArrayDisplay($aResult, "Test")

; New
_ArrayDisplay($aResult, "Files returned", Default, 8, Default, Default, Default, Default, $hUserFunction)
Now your final return will show the files and allow you to select one and open the relevant folder. :)

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

for MikahS

Avast

it is possible to correct this error?

for Melba23

I had already tried it, it gives me this error

Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$sFilePath = $aArray[$aSelected[1]]
$sFilePath = ^ ERROR

Edited by gius
Link to comment
Share on other sites

  • Moderators

gius,

Did you actually select a file in the dialog before pressing the "User Func" button? :huh:

To prevent this, you could change the user function code to read: :)

#include <Array.au3>
#include <File.au3>

; Get a list of files in the Windows folder
$aList = _FileListToArrayRec("C:\Windows", "*", $FLTAR_FILES, $FLTAR_NORECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH)

; Define the user function
Local $hUserFunction = _UserFunc
; And display the result - telling the UDF to use teh user function if required
_ArrayDisplay($aList, "Files returned", Default, 8, Default, Default, Default, Default, $hUserFunction)

; Now select a file in the dialog and press the "Use User Func" button to run the function below

Func _UserFunc($aArray, $aSelected)

    ; Check something is selected and is valid
    If $aSelected[0] And UBound($aArray) > $aSelected[0] Then
        ; Get first selected element
        $sFilePath = $aArray[$aSelected[1]]
        ; Remove the filename and just leave the folder path
        $sFolderPath = StringRegExpReplace($sFilePath, "(^.*)\\(.*)", "\1")
        ; Open the folder
        ShellExecute($sFolderPath)
    Else
        ; Display error dialog
        MsgBox(0, "Error", "No file selected")
    EndIf

EndFunc
If you still get an error then post the code you are running. :)

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

Thanks again Melba23.
Unfortunately it does not work yet, this is the code:

#include <File.au3>
#include <Array.au3>
#include <MsgBoxConstants.au3>



Local $hUserFunction = _UserFunc
Local $sFilter =  "*.doc;*.docx;*.txt;" ; Create a string with the correct format for multiple filters <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Global $folders[2] = [@DesktopDir, @MyDocumentsDir]
Global $aResult[100000][2], $n = 0
Local $word = InputBox(" ", "Search: ", " ", "", 100, -1, 500, 300)
For $k = 0 to UBound($folders)-1    ; loop through folders
  $aFiles = _FileListToArrayRec($folders[$k], $sFilter, 1, 1, 0, 2) ;
  If not @error Then
    For $i = 1 to $aFiles[0]   ; loop through files
       $content = FileRead($aFiles[$i])
       ; the following regex captures the full lines containing $word
       $res = StringRegExp($content, '(?im)(.*\b\Q' & $word & '\E\b.*)\R?', 3)  ; if $word must be a lone word
      ; $res = StringRegExp($content, '(?im)(.*\Q' & $word & '\E.*)\R?', 3)    ; if $word can be part of another word
        If IsArray($res) Then
            $aResult[$n][0] = $aFiles[$i]    ; file path
            For $j = 0 to UBound($res)-1
                $aResult[$n+$j][1] = $res[$j]    ; lines
            Next
            $n += $j
       EndIf
    Next

  EndIf
Next

Func _UserFunc($aArray, $aSelected)

    ; Check something is selected and is valid
    If $aSelected[0] And UBound($aArray) > $aSelected[0] Then
        ; Get first selected element
        $sFilePath = $aArray[$aSelected[1]]
        ; Remove the filename and just leave the folder path
        $sFolderPath = StringRegExpReplace($sFilePath, "(^.*)\\(.*)", "\1")
        ; Open the folder
        ShellExecute($sFolderPath)
    Else
        ; Display error dialog
        MsgBox(0, "Error", "No file selected")
    EndIf

EndFunc

Redim $aResult[$n][2]
;_ArrayDisplay($aResult, "Test")
_ArrayDisplay($aResult, "Files returned", Default, 8, Default, Default, Default, Default, $hUserFunction)

closes the program when I click on the button "run user func" with

Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$sFilePath = $aArray[$aSelected[1]]
$sFilePath = ^ ERROR

There's a reason it works with .doc and not with .odt or .xls or .ppt?

it is possible to change the text of the button "run user func", its size or delete other user keys func?

for MikahS

you can fix the problem with the antivirus?

thank you

Link to comment
Share on other sites

  • Moderators

gius,

My apologies, I have just realised you are passing a 2D array to the "user function" - so the syntax must match. Just change this line: :)

; Old version
; Get first selected element
        $sFilePath = $aArray[$aSelected[1]]

; New version
; Get first selected filename element
        $sFilePath = $aArray[$aSelected[1]][0] ; Now in 2D format
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

Thanks melba23,
works fine,
that's great!

 

There's a reason it works with .doc and not with .odt or .xls or .ppt?

it is possible to change the text of the button "run user func", its size or delete other user  button func?

thank you

Link to comment
Share on other sites

  • Moderators

gius,

 

There's a reason it works with .doc and not with .odt or .xls or .ppt?

Perhaps the regex does not work with those types of files because of their internal format. There is certainly no reason why the _FileListToArrayRecUDF will not find them. If you want to check that it does, add the following line after the call:

$aFiles = _FileListToArrayRec($folders[$k], $sFilter, 1, 1, 0, 2) ;
_ArrayDisplay($aFiles, "Files found in " & $folders[$k], Default, 8) ; Display the files found before using the Regex
That will show the files found or a MsgBox if there were none. :)

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 added it gives me this error

Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$aFiles = _FileListToArrayRec($folders[$k], $sFilter, 1, 1, 0, 2)
$aFiles = _FileListToArrayRec(^ ERROR

 

It is possible to change the text of the buttons "Exit script" "Run User Func",

or delete the button "Copy Data Only"?

thank you

Link to comment
Share on other sites

  • Moderators

gius,

Then you have changed something else as it worked perfectly when I tested it. Have you changed the $folders array from previous runs? :huh:

The button text is fixed within the _ArrayDisplay UDF - I added some button display options which you can see in the Help file, but they do not go as far as you wish. As I mentioned before, if you want a custom dialog then you need to create your own - _ArrayDisplay is intended more for debugging than use as a user dialog within a script. ;)

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

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...