3tones
Joined: 14 Dec 2004 Posts: 45 Location: Minneapolis, MN
|
Posted: Sat Jan 15, 2005 2:55 am Post subject: fileselectfile and multiple files |
|
|
I don't know if this has been changed in recent versions or if there already is an option for this...
If fileselect file is set to accept multiple files, the return is as follows (at least in 1.0.24)
single file: | Code: | | c:\myfolder\file1.txt`n |
multiple files: | Code: | | c:\myfolder\`nfile1.txt`nfile2.txt`n |
If the parse loop is used as given in the help file:
| Code: | ; MULTI-SELECT EXAMPLE:
FileSelectFile, files, 7 ; 7 = Multiselect existing files.
if files =
{
MsgBox, The user pressed cancel.
return
}
Loop, parse, files, `n
{
if A_LoopField = ; A blank field marks the end of the list.
break
if a_index = 1
MsgBox, The selected files are all contained in %A_LoopField%.
else
{
MsgBox, 4, , The next file is %A_LoopField%. Continue?
IfMsgBox, No, break
}
}
return
|
it will not work properly when selecting one file. I propose that whenever the multiselect option is used, it will always return as shown here:
| Code: | | c:\myfolder\`nfile1.txt`n | rather then as shown above. I have also written a little code to do this when needed:
| Code: |
;make 2 lines if one file
;look for more than one `n
stringgetpos, newline, filelist, `n, R2
;if only one
if ErrorLevel <> 0
{
;look for last slash
stringgetpos, lastslash, filelist, \, R
lastslash += 1
stringleft, leftside, filelist, %lastslash%
lastslash += 1
stringmid, rightside, filelist, %lastslash%, 100
;add `n between last slash and filename
filelist = %leftside%`n%rightside%
}
|
|
|