|
| ||||||||||
| Tags: dialog box, directory, iterating, realbasic, syntax |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Iterating selected files from dialog box
Code: Dim dlg as OpenDialog
Dim f as FolderItem
dlg=New OpenDialog
dlg.Title="Select file(s)"
dlg.MultiSelect = True
f=dlg.ShowModal()
MsgBox("dlg.Count = " + Str(dlg.Count)) /// shows the count of files selected |
|
#2
| ||||
| ||||
| Re: Iterating selected files from dialog box
Just have a look at COUNT and TRUE ITEM, if you get zero then it’s confirmed that the file in the FolderItem is not a directory. If it contains no file than its not a directory. The below code will do it for you: Code: if f.count>0 then
for i=0 to f.count-1
f2=f.trueitem(i)
next i
end if |
|
#3
| |||
| |||
| Re: Iterating selected files from dialog box
I drove my self into the same problem that is having sub directories under directories, which becomes tricky for us to handle. Also my set back was that RealBasic application pretends that it can select multiple lines in the fileopen dialog box but it doesn’t. It only makes us think that and it only returns only one. The other application that allows one file to be selected will allow only one to be highlighted in the dialog box. So REALbasic is bug to me. The problem is with RB2008 and RB2009 |
|
#4
| ||||
| ||||
| Re: Iterating selected files from dialog box
Language suggestion that tells us about property MultiSelect are:
|
|
#5
| |||
| |||
| Re: Iterating selected files from dialog box
The below code I have personally tested by myself and its working fine with me. But remember that the following code is tested only on windows. If you have different operating system then it might differ. Code: Dim dlg AS OpenDialog = New OpenDialog
Dim ffile AS FolderItem
dlg.MultiSelect = True
ffile = dlg.ShowModal()
for i As Integer = 0 to dlg.Count-1
ffile = dlg.item(i)
If ffile.exists Then
'Do something with the file
End If
next |
|
#6
| |||
| |||
| Re: Iterating selected files from dialog box
I have done many researches over the internet and came to conclusion that the REALbasic OpenDialog Folderitem multiselect option does not work properly. I wonder why it doesn’t because its documentation reports that it is a feature of it. Actually I am a new to REALbasic but competent to Applescripter. Currently I have created an Applescript that will display identical file selection dialog box as REALbasic. But you can select more than one file at a time. The disadvantage would be that the names of the files that have to be returned to their regular budget proposal as a value of comma-delimited string, but this is easily converted into a string array of filenames, which can give RB code for that. |
|
#7
| ||||
| ||||
| Re: Iterating selected files from dialog box
Try the below code in your actual source code. It would allow the names of the files to return to there regular string. It is based on REALbasic, it will work properly. Code: Option Compare Database Option Explicit Private Sub cmdFileDialog_Click() Dim fDialog As Office.FileDialog Dim varFile As Variant ' Clear the list box contents. Me.FileList.RowSource = "" ' Set up the File dialog box. Set fDialog = Application.FileDialog(msoFileDialogFilePicker) With fDialog ' Allow the user to make multiple selections in the dialog box. .AllowMultiSelect = True ' Set the title of the dialog box. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Iterating selected files from dialog box" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Microsoft Security Essentials: unable to scan selected files | Ouka | Networking & Security | 4 | 28-08-2011 09:44 AM |
| Windows 7: Files are automatically get selected and Links are opened by hovering Mouse | hostess | Hardware Peripherals | 6 | 09-03-2011 09:35 AM |
| Can nokia N79 music player play files only from a selected folder | Jhooda | Portable Devices | 3 | 06-01-2011 07:13 PM |
| How to move files from temp dir to selected after completion in uTorrent? | Kusumakar | Technology & Internet | 6 | 24-06-2010 10:32 PM |
| Files Remain Hidden Even though I selected show Hidden & Protected | LabTechnician | Vista Help | 9 | 07-05-2007 01:32 PM |