johnmcloud Posted January 3, 2012 Posted January 3, 2012 (edited) Hi guys, with help of M23 now i have this script: $Path = GUICtrlRead($FolderInput) $Pre = @TempDir & "\Test.exe" $Command = "-e -p" $Folders= _FileListToArray($Path, '*', 1) $Folders[0] = "@echo off" & @CRLF $fFlag = "" AdlibRegister("Update",333) For $i = 1 To UBound($Folders) - 1 If RunWait(@ComSpec & " /c " & $pre & " " & $command & " " & $Password & " " & '"' & $Path & "\" & $Folders[$i] & '"', @TempDir, @SW_HIDE) = 0 Then ConsoleWrite("Information - Success") Else $fFlag &= $i & "|" EndIf ConsoleWrite("Information - Fail") Next If $fFlag = "" Then If GUICtrlRead($FolderCheckboxCrypt) = $GUI_CHECKED Then Func() EndIf FileDelete(@TempDir & "\Test.txt") MsgBox(0, "Information","OK") Else $aFailed = StringSplit($fFlag, "|") $sMsg = "Error:" & @CRLF & @CRLF For $i = 1 To $aFailed[0] - 1 $sMsg &= $Folders[$aFailed[$i]] & @CRLF Next FileDelete(@TempDir & "\Test.exe") MsgBox(16, "Error", $sMsg) EndIf AdlibUnRegister("Update") WinSetTitle($GUI,"","Test name") EndFunc From option of _FileListToArray i see you can select exstension to process by array, ad example *.txt But i don' find something to exclude an extension from array. Someone can resolve this doubt? Thanks to all for support, i'll grateful to this forum Edited January 3, 2012 by johnmcloud
Moderators Melba23 Posted January 3, 2012 Moderators Posted January 3, 2012 johnmcloud,Look at the RecFileListToArray UDF in my sig - it allows you to include/exclude multiple options. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
johnmcloud Posted January 3, 2012 Author Posted January 3, 2012 (edited) Thanks Melba, but somethig is wrong becouse file will be not processed. I have change only this part with helper ( i have test it and esclude the extension ) #include <RecFileListToArray.au3> $Folders= _RecFileListToArray($Path, "*.*", 1, 0, 0, 2, "*.txt", "") I don't have error, but the file will be not processed Edited January 3, 2012 by johnmcloud
Moderators Melba23 Posted January 3, 2012 Moderators Posted January 3, 2012 johnmcloud,the file will be not processedI do not understand what you mean. When I run your snippet I get the all the files from the folder (less the excluded ones) in the returned array. And why do you call the array $Folders when you are asking for files only to be returned? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
johnmcloud Posted January 3, 2012 Author Posted January 3, 2012 (edited) $Path = GUICtrlRead($FolderInput) $Pre = @TempDir & "Test.exe" $Command = "-e -p" $Folders= _RecFileListToArray($Path, "*.*", 1, 0, 0, 2, "*.txt", "") $Folders[0] = "@echo off" & @CRLF $fFlag = "" AdlibRegister("Update",333) For $i = 1 To UBound($Folders) - 1 If RunWait(@ComSpec & " /c " & $pre & " " & $command & " " & $Password & " " & '"' & $Path & "" & $Folders[$i] & '"', @TempDir, @SW_HIDE) = 0 Then ConsoleWrite("Information - Success") Else $fFlag &= $i & "|" EndIf ConsoleWrite("Information - Fail") Next If $fFlag = "" Then If GUICtrlRead($FolderCheckboxCrypt) = $GUI_CHECKED Then Func() EndIf FileDelete(@TempDir & "Test.txt") MsgBox(0, "Information","OK") Else $aFailed = StringSplit($fFlag, "|") $sMsg = "Error:" & @CRLF & @CRLF For $i = 1 To $aFailed[0] - 1 $sMsg &= $Folders[$aFailed[$i]] & @CRLF Next FileDelete(@TempDir & "Test.exe") MsgBox(16, "Error", $sMsg) EndIf AdlibUnRegister("Update") WinSetTitle($GUI,"","Test name") EndFuncIs the same code, with the _FileListToArray($Path, '*', 1) work fine but process all file, with _RecFileListToArray don't process any file ( and give me msgbox "OK" )For the name $folders... it's copy past code, in the same script it process folder and i forget to reneame Edited January 3, 2012 by johnmcloud
Moderators Melba23 Posted January 3, 2012 Moderators Posted January 3, 2012 johnmcloud,Use _ArrayDisplay and see what difference there is between the arrays returned by _FileListToArray and _RecFileListToArray. Using $iReturnPath = 2 you are getting the "Full path" for the files returned by _RecFileListToArray. So I believe you will no longer need to add the path again in your RunWait line. Or you could use $iReturnPath = 1 to get the "Relative path" as returned by _FileListToArray. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
johnmcloud Posted January 3, 2012 Author Posted January 3, 2012 (edited) johnmcloud, Use _ArrayDisplay and see what difference there is between the arrays returned by _FileListToArray and _RecFileListToArray Yeah, there is a difference of path, you have right, i'm too noob I have change this: $Folders= _RecFileListToArray($Path, "*.*", 0, 0, 0, 1, "*.txt", "") It processed two time the path in cmd, i'll set the relative now. Thanks for support Melba and for UDF Edited January 3, 2012 by johnmcloud
Moderators Melba23 Posted January 3, 2012 Moderators Posted January 3, 2012 johnmcloud, Glad I could help. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now