3

I am writing a picture editing program and am using the below snippet to choose the files:

$var = FileOpenDialog("",@DesktopDir,"Images (*.jpg;*.bmp;*.png)",1+4)
$var = StringReplace($var, "|", @CRLF)

When I select multiple files all the file names are stored in $var separated by the | symbol. I replace that symbol with a newline character. But I need to run the program for all the filenames and I can't figure out how to separate the various filenames from the variable. So my programs stops if I select multiple files.

user4157124
  • 2,809
  • 13
  • 27
  • 42
Jonah
  • 2,097
  • 4
  • 20
  • 22

1 Answers1

5
$var = FileOpenDialog("", @DesktopDir, "Images (*.jpg;*.bmp;*.png)", 1+4)
$files = StringSplit($var, "|", 2)

For $i = 0 To UBound($files)-1
    $file = $files[$i]
    ConsoleWrite($file & @CRLF) ; Do something with file
Next

For me the results look like this:

C:\Users\Manadar\Desktop
skin1.png
skin2.png

So it's:

  • Directory of files
  • File1
  • File2
  • File3

etc.

Jos van Egmond
  • 2,370
  • 15
  • 19