JibsMan Posted February 24, 2015 Share Posted February 24, 2015 The FileSelectFolder function does not appear to display the files in the selected directory. I found many different examples of other FileSelectFolder functions, some by Melba23, which are way cool but not quite what I need. If the standard FileSelectFolder just displayed the files in the currently selected directory I could move on. Problem is the user might not know where the files they want to process are located. A possible solution is to display directories with files and either allow the user to select all the .bat files to copy to an array or just automatically copy all .bat files into the array. Some of you like to know the "why" of things: This entire exercise is to copy / rename a single file.txt to the same name as the .bat filenames in the selected dir. File1.bat File2.bat File3.bat Copy TestFile.txt to: File1.txt File2.txt File3.txt so there are both .bat and .txt files for each .bat filename. The user must decide which directory they want to process, and needs to see what's in the directory to select it. Doesn't matter if it's the standard Explorer window or a custom explorer. If you know of one I could try I'd certainly appreciate it! Thanks in advance! Jibs SorryButImaNewbie 1 Link to comment Share on other sites More sharing options...
Solution Radiance Posted February 25, 2015 Solution Share Posted February 25, 2015 That's why it's called FileSelectFolder() Try the FileOpenDialog(), that might just be what you need. SadBunny and JibsMan 2 Link to comment Share on other sites More sharing options...
SadBunny Posted February 25, 2015 Share Posted February 25, 2015 How about something like this? #include <FileConstants.au3> #include <StringConstants.au3> $batchfiles = FileOpenDialog("test", "c:\tmp", "Batch files (*.bat)", $FD_MULTISELECT) If @error Then MsgBox(16, "Failed", "File selection failed, error: " & @error) Exit EndIf ConsoleWrite("Chosen batchfiles: " & $batchfiles & @CRLF) If StringInStr($batchfiles, "|") Then ; contains a pipe, means multiple batchfiles were selected $chosenArray = StringSplit($batchfiles, "|") ; Say we have "c:\tmp|x.bat|y.bat", the array elements after split will be: ; [0]: 3 ; [1]: "c:\tmp" ; [2]: "x.bat" ; [3]: "y.bat" $folder = $chosenArray[1] for $i = 2 to $chosenArray[0] $file = $chosenArray[$i] $filepath = $folder & "\" & $file ConsoleWrite("Doing magic on file: " & $filepath & @CRLF) Next Else ConsoleWrite("Doing magic on file: " & $batchfiles & @CRLF) EndIf JibsMan 1 Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
JibsMan Posted February 25, 2015 Author Share Posted February 25, 2015 How do I mark both answers as "Solved"?! I'll mark Radiance since SadBunny has solved so many questions already, and Radiance was first! Thank You! Missed this function completely! And Thank You to SadBunny for the code Jibs Link to comment Share on other sites More sharing options...
SadBunny Posted February 25, 2015 Share Posted February 25, 2015 How do I mark both answers as "Solved"?! I'll mark Radiance since SadBunny has solved so many questions already, and Radiance was first! Thank You! Missed this function completely! And Thank You to SadBunny for the code Jibs No problem friend, we don't do it for the points score here, at least I don't. As we say in Dutch, "small effort, big pleasure". Melba23, JibsMan and kcvinu 3 Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
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