iceberg Posted July 24, 2015 Share Posted July 24, 2015 (edited) Hi Guys,This is straight from the Help File.#include <FileConstants.au3> #include <MsgBoxConstants.au3> Example() Func Example() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the list of selected files. MsgBox($MB_SYSTEMMODAL, "", "You chose the following files:" & @CRLF & $sFileOpenDialog) EndIf EndFunc ;==>ExampleQuestion is how do i MsgBox the fullpath of each selected file individually?Thank you! Edited July 24, 2015 by iceberg clarification mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 24, 2015 Moderators Share Posted July 24, 2015 iceberg,The Help file tells you that the return from FileOpenDialog is as follows:Success: the full path of the file(s) chosen. Results for multiple selections are "Directory|file1|file2|...".So use StringSplit to break down the returned string and then loop through the resultant array to list the files.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 Link to comment Share on other sites More sharing options...
iceberg Posted July 24, 2015 Author Share Posted July 24, 2015 Got It, Melba!thanks for the lead. cheers!Local $out = StringSplit($sFileOpenDialog, "|") For $i = 2 To $out[0] ; Loop through the array returned by StringSplit to display the individual values. MsgBox($MB_SYSTEMMODAL, "", $out[1] & "\" & $out[$i]) Next GoogleGonnaSaveUs 1 mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 24, 2015 Moderators Share Posted July 24, 2015 iceberg,Do not forget to cater for a possible single return - your current code will fail if that is the case.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 Link to comment Share on other sites More sharing options...
iceberg Posted July 25, 2015 Author Share Posted July 25, 2015 ooops.... oh ya!tat didnt cross my mind. but how do i achieve that? kindly assist me. Thx! mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 25, 2015 Moderators Share Posted July 25, 2015 iceberg,If you expect multiple file selection to be the norm then I would simply check for @error after using StringSplit. If there is an error then no " | " delimiters were found and so only a single file was returned, which you can display immediately - if there is no error then you can use the code you posted above to list them.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 Link to comment Share on other sites More sharing options...
iceberg Posted July 26, 2015 Author Share Posted July 26, 2015 thank you once again Melba23! mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
kylomas Posted July 26, 2015 Share Posted July 26, 2015 (edited) iceberg,You can make your routine to process file generic like this...Local $out = StringSplit($sFileOpenDialog, "|") For $i = 1 To $out[0] ; Loop through the array returned by StringSplit to display the individual values. MsgBox($MB_SYSTEMMODAL, "", $out[$i]) Nextso that you do not have to worry about number of files selected.kylomasedit: This works because...If no delimiters were found then the @error flag is set to 1, count is equal to 1 ($aArray[0]) and the full string is returned ($aArray[1]). Edited July 26, 2015 by kylomas explanation Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
iceberg Posted July 27, 2015 Author Share Posted July 27, 2015 thanks for the additional info kylomas. mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
kylomas Posted July 27, 2015 Share Posted July 27, 2015 Anytime Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 27, 2015 Moderators Share Posted July 27, 2015 kylomas,I am afraid that will not work - look at the return format for the function in the Help file (or post #2 above). If you have multiple files then the MsgBox will first display the path and then the simple file names - so to get the full filenames for multiple files you need to concatenate as shown in post #3 above, but for a single file you do not.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 Link to comment Share on other sites More sharing options...
kylomas Posted July 27, 2015 Share Posted July 27, 2015 @M23 - You are right! Don't know what the hell I was thinking, if anything at all... Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill 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