#31030 - 2002-10-21 01:55 AM
Can I use OpenFileDialog to select folders
|
mfleeming
Lurker
Registered: 2002-10-21
Posts: 3
|
I can select files, but would like to return a folder path even if the folder is empty.
Is this possible?
|
Top
|
|
|
|
#31031 - 2002-10-21 02:28 PM
Re: Can I use OpenFileDialog to select folders
|
Chris S.
MM club member
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
If you just want to browse for folder, use this...
code:
$objShell = CreateObject("Shell.Application") $objFolder = $objShell.BrowseForFolder(0, "Select a folder:", 0) $objFolderItem = $objFolder.Self ? $objFolderItem.Name ? $objFolderItem.Parent ? $objFolderItem.Path ? $objFolderItem.Size ? $objFolderItem.Type
|
Top
|
|
|
|
#31032 - 2002-10-21 07:52 PM
Re: Can I use OpenFileDialog to select folders
|
mfleeming
Lurker
Registered: 2002-10-21
Posts: 3
|
Wonderful, Sir, thank you.
Whilst we're on a winning streak, can I also ask if it can be seeded by a currently selected folder (say from an ini file)?
Also, where would be a good place to get some idea of other objects I can use? I usually program in a 4GL business language so I'm not familiar with Windows programing.
|
Top
|
|
|
|
#31034 - 2002-10-21 08:46 PM
Re: Can I use OpenFileDialog to select folders
|
Chris S.
MM club member
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
The short answer is, yes.
code:
$objFolder = $objShell.BrowseForFolder(0, "Select a folder:", 0, "c:\archive")
Doing this, however, makes this item the top level in your browser tree. I.E. They can browse below, but not above your default directory. Could be a good thing, depending on how you want to use it.
|
Top
|
|
|
|
#31035 - 2003-01-09 12:47 AM
Re: Can I use OpenFileDialog to select folders
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
This is returning nothing for me on XP... code:
$objShell = CreateObject("Shell.Application") $objFolder = $objShell.BrowseForFolder(0, "Select a folder:", 16384) $objFolderItem = $objFolder.Self $selectedfile = $objFolderItem.Path Status($objFolderItem.Name) Status($objFolderItem.Parent) Status($objFolderItem.path) Status($objFolderItem.type) Status($selectedfile)
Status() is a function for dumping the info to a kixform listbox (yes the function works...)
Any help? [ 09. January 2003, 00:48: Message edited by: Radimus ]
|
Top
|
|
|
|
#31036 - 2003-01-09 12:54 AM
Re: Can I use OpenFileDialog to select folders
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
ahhhh... it will return infor for folders but not files..
dammit^2
|
Top
|
|
|
|
#31038 - 2003-01-09 03:12 AM
Re: Can I use OpenFileDialog to select folders
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
that is what I had to do anyway...
This works perfectly...
Thanks Bud
|
Top
|
|
|
|
#31039 - 2003-01-09 03:32 AM
Re: Can I use OpenFileDialog to select folders
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
BTW... what are the parameters for $Form.FileOpenDialog("Open", ".\", "", "", 0)
|
Top
|
|
|
|
#31040 - 2003-01-09 04:12 AM
Re: Can I use OpenFileDialog to select folders
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Good news - this is from KIXLIST.DOC available from Kixforms.org:
quote:
FileOpenDialog ( String Title, String Directory, String Filename, String Filters, Number Flags ) as String
FileSaveDialog ( String Title, String Directory, String Filename, String Filters, Number Flags )
Display the system "File Open" and “File Save” dialog box.
Title - The title of the dialog box.
Directory - The default directory that you want to use when the dialog is displayed.
FileName - The default filename that you want to appear when the dialog is displayed.
Filters – User defined string of filters that can limit the files displayed. For example:"Bitmaps|*.bmp|All Files|*.*"
Flags – One or more of the following flags specifying how to create the file dialog box.
Returns a string specifying the selected or file, or NULL if no file selected.
Never didn't finish the flags parm but just set it to zero. Chris S. was kind enough to document a much better version of above but it hasn't been published yet.
-Shawn [ 09. January 2003, 04:13: Message edited by: Shawn ]
|
Top
|
|
|
|
#31041 - 2003-01-09 03:04 PM
Re: Can I use OpenFileDialog to select folders
|
Chris S.
MM club member
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Rad, you have mail.
|
Top
|
|
|
|
#31042 - 2003-01-09 03:22 PM
Re: Can I use OpenFileDialog to select folders
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
thank you sir.
This was Exactly what I needed.
$FileName = $Form.FileOpenDialog("Find engine.exe Update", ".\", "", "SuperDat|*eng.exe", 0)
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 507 anonymous users online.
|
|
|