Page 1 of 1 1
Topic Options
#31030 - 2002-10-21 01:55 AM Can I use OpenFileDialog to select folders
mfleeming Offline
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. Offline
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 Offline
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
#31033 - 2002-10-21 07:54 PM Re: Can I use OpenFileDialog to select folders
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
In general, the MSDN documentation will contain everything regarding scriptable object. It also contains a plethora of examples.
_________________________
There are two types of vessels, submarines and targets.

Top
#31034 - 2002-10-21 08:46 PM Re: Can I use OpenFileDialog to select folders
Chris S. Offline
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. [Big Grin]

Top
#31035 - 2003-01-09 12:47 AM Re: Can I use OpenFileDialog to select folders
Radimus Moderator Offline
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 ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#31036 - 2003-01-09 12:54 AM Re: Can I use OpenFileDialog to select folders
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
ahhhh... it will return infor for folders but not files..

dammit^2
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#31037 - 2003-01-09 02:40 AM Re: Can I use OpenFileDialog to select folders
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Rad - FileOpenDialog() could be thought of as like a BrowseForFile() function ?

$FileName = $Form.FileOpenDialog("Open", ".\", "", "", 0)

[edit] crap but then you would have to parse-out the returned string i guess.

-Shawn

[ 09. January 2003, 02:43: Message edited by: Shawn ]

Top
#31038 - 2003-01-09 03:12 AM Re: Can I use OpenFileDialog to select folders
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
that is what I had to do anyway...

This works perfectly...

Thanks Bud
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#31039 - 2003-01-09 03:32 AM Re: Can I use OpenFileDialog to select folders
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
BTW... what are the parameters for $Form.FileOpenDialog("Open", ".\", "", "", 0)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#31040 - 2003-01-09 04:12 AM Re: Can I use OpenFileDialog to select folders
Shawn Administrator Offline
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. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Rad, you have mail. [Smile]
Top
#31042 - 2003-01-09 03:22 PM Re: Can I use OpenFileDialog to select folders
Radimus Moderator Offline
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)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.06 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org