Selecting directory and choosing filtered file extensions.
Moderator: Rathinagiri
Selecting directory and choosing filtered file extensions.
I need to start with a windows directory tree, select a directory and select a
specified file extension if it exists.
I'm sure there's a sample for this, but I cannot find it.
specified file extension if it exists.
I'm sure there's a sample for this, but I cannot find it.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Selecting directory and choosing filtered file extension
You have to use GetFile() function.
Syntax of GetFile()
If <lMultiSelect> option is used, a character array containing selected
(maximun number of selected files returned is 63).
Syntax of GetFile()
Code: Select all
GetFile ( acFilter , cTitle , cDefaultPath , lMultiSelect , lNoChangeDir ) -->SelectedFileName(s)
(maximun number of selected files returned is 63).
Code: Select all
eg.: GetFile( { { "*.prg", "Harbour Program Files" }, { "*.ch", "Harbour Header Files" } } ,;
"Select a prg/ch file")
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Selecting directory and choosing filtered file extension
GetFile( { { "*.prg", "Harbour Program Files" }, { "*.ch", "Harbour Header Files" } } ,;
"Select a prg/ch file")
Opens the directory screen and allows changing directories, but does not list any *.prg files in directories where they exist.
Pardon my ignorance.
"Select a prg/ch file")
Opens the directory screen and allows changing directories, but does not list any *.prg files in directories where they exist.
Pardon my ignorance.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Selecting directory and choosing filtered file extension
Sorry. You have to write like this.
GetFile( { { "Harbour Program Files", "*.prg" }, { "Harbour Header Files", "*.ch" } } ,;
"Select a prg/ch file")
GetFile( { { "Harbour Program Files", "*.prg" }, { "Harbour Header Files", "*.ch" } } ,;
"Select a prg/ch file")
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Selecting directory and choosing filtered file extension
Does this return the location and file name for selecting? My program will parse the selected file into a DBF.
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Selecting directory and choosing filtered file extension
Yes.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Selecting directory and choosing filtered file extension
If I use:
tempx = GetFile( { { "Harbour Program Files", "*.prg" }, { "Harbour Header Files", "*.ch" } } ,;
"Select a prg/ch file")
and
MsgInfo (tempx)
I get blank message box. How is best way to "see" the info in tempx?
tempx = GetFile( { { "Harbour Program Files", "*.prg" }, { "Harbour Header Files", "*.ch" } } ,;
"Select a prg/ch file")
and
MsgInfo (tempx)
I get blank message box. How is best way to "see" the info in tempx?
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Selecting directory and choosing filtered file extension
Did you click cancel in the GetFile dialog?
It returns the selected filename along with the path.
Please try this sample...
It returns the selected filename along with the path.
Please try this sample...
Code: Select all
#include <hmg.ch>
Function Main
cFileName := GetFile( { { "Harbour Program Files", "*.prg" }, { "Harbour Header Files", "*.ch" } } ,;
"Select a prg/ch file")
MsgInfo ( cFileName )
Return
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.