Guest Ov6rMinD Posted July 3, 2005 Share Posted July 3, 2005 Hello, I am French but I need help: I have this code : $message = "Appuyez sur Shift ou Ctrl pour choisir plusieurs fichiers." $var = FileOpenDialog($message, "My Documents", "Son et vidéos (*.m3u;*.avi;*.mp3;*.mpeg;*.wav;*.jpg)", 1 + 2 + 4 ) If @error Then MsgBox(4096,"","Acun fichier(s) choisi") Else $var = StringReplace($var, "|", @CRLF) MsgBox(4096,"","You chose " & $var) And I get $var to another program in oder to add files in the list. This method is good for one file, but not for more files. Help! Thanks! JMD Link to comment Share on other sites More sharing options...
/dev/null Posted July 3, 2005 Share Posted July 3, 2005 And I get $var to another program in oder to add files in the list.This method is good for one file, but not for more files.from help file: FileOpenDialogReturns the full path of the file(s) chosen. Results for multiple selections are "Directory|file1|file2|..."Use StringSplit to get the selected files in an array.$files = StringSplit($var, "|") $directory = $files[1] $file1 = $files[2] $file2 = $files[3] $file3 = $files[4] etc.CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
Guest Ov6rMinD Posted July 3, 2005 Share Posted July 3, 2005 $files = StringSplit($var, "|") $directory = $files[1] $file1 = $files[2] $file2 = $files[3] $file3 = $files[4] etc. Thanks, but the problem is that the number of files is never the same! Link to comment Share on other sites More sharing options...
jpm Posted July 3, 2005 Share Posted July 3, 2005 Thanks, but the problem is that the number of files is never the same!<{POST_SNAPBACK}>UBound allow to know the dimension of an array Link to comment Share on other sites More sharing options...
Guest Ov6rMinD Posted July 3, 2005 Share Posted July 3, 2005 Thanks but I am a beginner. Can you write a script please? Thank you! Link to comment Share on other sites More sharing options...
jpm Posted July 3, 2005 Share Posted July 3, 2005 (edited) $message = "Appuyez sur Shift ou Ctrl pour choisir plusieurs fichiers." $var = FileOpenDialog($message, "My Documents", "Son et vidéos (*.m3u;*.avi;*.mp3;*.mpeg;*.wav;*.jpg)", 1 + 2 + 4 ) If @error Then MsgBox(4096,"","Aucun fichier choisi") Else $files = Stringsplit($var, "|", @CRLF) For $i =1 to UBOUND($files)-1 MsgBox(4096, $files[0]),"Vous avez choisi " & $files[$i]) next endif Edited July 3, 2005 by jpm Link to comment Share on other sites More sharing options...
jefhal Posted July 3, 2005 Share Posted July 3, 2005 (edited) This array number-count requires some serious bookkeeping in this script. How about this small tweak?: For $i =2 to UBOUND($files) -1 Edited July 3, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
jpm Posted July 4, 2005 Share Posted July 4, 2005 This array number-count requires some serious bookkeeping in this script. How about this small tweak?:For $i =2 to UBOUND($files) -1<{POST_SNAPBACK}>You right I didn't remember the [0] was the count so UBOUND is not really needed$message = "Appuyez sur Shift ou Ctrl pour choisir plusieurs fichiers." $var = FileOpenDialog($message, "My Documents", "Son et vidéos (*.m3u;*.avi;*.mp3;*.mpeg;*.wav;*.jpg)", 1 + 2 + 4 ) If @error Then MsgBox(4096,"","Aucun fichier choisi") Else $files = Stringsplit($var, "|", @CRLF) For $i =2 to $files[0] MsgBox(4096, $files[1]),"Vous avez choisi " & $files[$i]) next endif 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