I need to have a user choose a file with a specific extension from a specific folder. I assumed I could simply pass a file skeleton to GETFILE like one does to ADIR. When I try that FoxPro seems to navigate to the proper folder but does not show any contents in the folder.
I looked up the docs on GETFILE and it appears that specifying the path to a specific folder is not a valid use. One needs to "SET DEFAULT TO" the desired path in a separate operation and then call GETFILE with the desired extension. This appears to work but when I tried to save and restore the setting of DEFAULT before and after this use I discovered that no matter what I do, ?SET('DEFAULT') always returns 'C:'. Since "SET DEFAULT TO" (invalid path) gives an error and GETFILE respects the setting - apparently the default value is being set but just not reported. My conclusion is that the recommended "m.SaveDef = SET('DEFAULT')" before and "SET DEFAULT TO m.SaveDef) after really do nothing.
Am I missing something?
Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html ---
Try this:
m.SaveDef = set('DEFAULT')
set default to .......
do your thing
then get back with
set default to &m.SaveDef
or
set default to (m.SaveDef)
Rafael Copquin
On 20/07/2016 16:50, Joe Yoder wrote:
I need to have a user choose a file with a specific extension from a specific folder. I assumed I could simply pass a file skeleton to GETFILE like one does to ADIR. When I try that FoxPro seems to navigate to the proper folder but does not show any contents in the folder.
I looked up the docs on GETFILE and it appears that specifying the path to a specific folder is not a valid use. One needs to "SET DEFAULT TO" the desired path in a separate operation and then call GETFILE with the desired extension. This appears to work but when I tried to save and restore the setting of DEFAULT before and after this use I discovered that no matter what I do, ?SET('DEFAULT') always returns 'C:'. Since "SET DEFAULT TO" (invalid path) gives an error and GETFILE respects the setting - apparently the default value is being set but just not reported. My conclusion is that the recommended "m.SaveDef = SET('DEFAULT')" before and "SET DEFAULT TO m.SaveDef) after really do nothing.
Am I missing something?
Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
I've always fund that when macro expanding a memvar you don't want the m. so
Set default to &saveDef
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of rafael copquin Sent: Wednesday, July 20, 2016 3:57 PM To: profoxtech@leafe.com Subject: Re: GETFILE and SET DEFAULT
Try this:
m.SaveDef = set('DEFAULT')
set default to .......
do your thing
then get back with
set default to &m.SaveDef
or
set default to (m.SaveDef)
Rafael Copquin
On 20/07/2016 16:50, Joe Yoder wrote:
I need to have a user choose a file with a specific extension from a specific folder. I assumed I could simply pass a file skeleton to GETFILE like one does to ADIR. When I try that FoxPro seems to navigate to the proper folder but does not show any contents in the folder.
I looked up the docs on GETFILE and it appears that specifying the path to a specific folder is not a valid use. One needs to "SET DEFAULT TO" the desired path in a separate operation and then call GETFILE with the desired extension. This appears to work but when I tried to save and restore the setting of DEFAULT before and after this use I discovered that no matter what I do, ?SET('DEFAULT') always returns 'C:'. Since "SET DEFAULT TO" (invalid path) gives an error and GETFILE respects the setting - apparently the default value is being set but just not reported. My conclusion is that the recommended "m.SaveDef = SET('DEFAULT')" before and "SET DEFAULT TO m.SaveDef) after really do nothing.
Am I missing something?
Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
Set default to &saveDef
Won't work if the directory path name contains spaces so better to do:
Set default to (saveDef)
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Richard Kaye Sent: 20 July 2016 21:29 To: profox@leafe.com Subject: RE: GETFILE and SET DEFAULT
I've always fund that when macro expanding a memvar you don't want the m. so
Set default to &saveDef
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of rafael copquin Sent: Wednesday, July 20, 2016 3:57 PM To: profoxtech@leafe.com Subject: Re: GETFILE and SET DEFAULT
Try this:
m.SaveDef = set('DEFAULT')
set default to .......
do your thing
then get back with
set default to &m.SaveDef
or
set default to (m.SaveDef)
Rafael Copquin
On 20/07/2016 16:50, Joe Yoder wrote:
I need to have a user choose a file with a specific extension from a specific folder. I assumed I could simply pass a file skeleton to GETFILE like one does to ADIR. When I try that FoxPro seems to navigate to the proper folder but does not show any contents in the folder.
I looked up the docs on GETFILE and it appears that specifying the path to a specific folder is not a valid use. One needs to "SET DEFAULT TO" the desired path in a separate operation and then call GETFILE with the desired extension. This appears to work but when I tried to save and restore the setting of DEFAULT before and after this use I discovered that no matter what I do, ?SET('DEFAULT') always returns 'C:'. Since "SET DEFAULT TO" (invalid path) gives an error and GETFILE respects the setting - apparently the default value is being set but just not reported. My conclusion is that the recommended "m.SaveDef = SET('DEFAULT')" before and "SET DEFAULT TO m.SaveDef) after really do nothing.
Am I missing something?
Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
Actually I discovered that my code was disappearing after the commands were executed so I did some more Googling and found that the value to be saved is returned by CURDIR() rather than SET('DEFAULT'). It gets restored with "SET DEFAULT TO." That explains why things weren't working for me! Somehow it seems better terminology could have been chosen!
Thanks,
Joe
On Wed, Jul 20, 2016 at 3:57 PM, rafael copquin rafael.copquin@gmail.com wrote:
Try this:
m.SaveDef = set('DEFAULT')
set default to .......
do your thing
then get back with
set default to &m.SaveDef
or
set default to (m.SaveDef)
Rafael Copquin
On 20/07/2016 16:50, Joe Yoder wrote:
I need to have a user choose a file with a specific extension from a specific folder. I assumed I could simply pass a file skeleton to GETFILE like one does to ADIR. When I try that FoxPro seems to navigate to the proper folder but does not show any contents in the folder.
I looked up the docs on GETFILE and it appears that specifying the path to a specific folder is not a valid use. One needs to "SET DEFAULT TO" the desired path in a separate operation and then call GETFILE with the desired extension. This appears to work but when I tried to save and restore the setting of DEFAULT before and after this use I discovered that no matter what I do, ?SET('DEFAULT') always returns 'C:'. Since "SET DEFAULT TO" (invalid path) gives an error and GETFILE respects the setting - apparently the default value is being set but just not reported. My conclusion is that the recommended "m.SaveDef = SET('DEFAULT')" before and "SET DEFAULT TO m.SaveDef) after really do nothing.
Am I missing something?
Thanks in advance,
Joe
--- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html
[excessive quoting removed by server]
HackFox7 says:
"For some reason, SET("DEFAULT") has never been enhanced to keep up with the times. It still returns just the drive with no path. No extra parameters or anything to let you find the path. Of course, CURDIR() provides the path. Even better, the undocumented SET("DIRECTORY") gives you the drive and path as a single string."
On Wed, Jul 20, 2016 at 4:34 PM, Joe Yoder joe@wheypower.com wrote:
Actually I discovered that my code was disappearing after the commands were executed so I did some more Googling and found that the value to be saved is returned by CURDIR() rather than SET('DEFAULT'). It gets restored with "SET DEFAULT TO." That explains why things weren't working for me! Somehow it seems better terminology could have been chosen!
Visual FoxPro is an amalgam of dBASE, Fox, a bunch of obscure SYS() functions, and at least three different menu and screen design systems you shouldn't be using any more. There's a lot of abtuse corners to thwack your shins on.
Luckily, the language has finally stabilized, so all the inconsistencies can be documented.
If you really want to save off the fully qualified path, use a combination of SYS(5) and SYS(2003). The first function gives you the drive letter and the 2nd function gives you the folder hierarchy. It's also the same thing as CURDIR(). So something like this:
m.saveDef=SYS(5)+SYS(2003)
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Joe Yoder Sent: Wednesday, July 20, 2016 4:34 PM To: profoxtech@leafe.com Subject: Re: GETFILE and SET DEFAULT
Actually I discovered that my code was disappearing after the commands were executed so I did some more Googling and found that the value to be saved is returned by CURDIR() rather than SET('DEFAULT'). It gets restored with "SET DEFAULT TO." That explains why things weren't working for me! Somehow it seems better terminology could have been chosen!
Thanks,
Joe
On Wed, Jul 20, 2016 at 3:57 PM, rafael copquin rafael.copquin@gmail.com wrote:
Try this:
m.SaveDef = set('DEFAULT')
set default to .......
do your thing
then get back with
set default to &m.SaveDef
or
set default to (m.SaveDef)
Rafael Copquin
On 20/07/2016 16:50, Joe Yoder wrote:
I need to have a user choose a file with a specific extension from a specific folder. I assumed I could simply pass a file skeleton to GETFILE like one does to ADIR. When I try that FoxPro seems to navigate to the proper folder but does not show any contents in the folder.
I looked up the docs on GETFILE and it appears that specifying the path to a specific folder is not a valid use. One needs to "SET DEFAULT TO" the desired path in a separate operation and then call GETFILE with the desired extension. This appears to work but when I tried to save and restore the setting of DEFAULT before and after this use I discovered that no matter what I do, ?SET('DEFAULT') always returns 'C:'. Since "SET DEFAULT TO" (invalid path) gives an error and GETFILE respects the setting - apparently the default value is being set but just not reported. My conclusion is that the recommended "m.SaveDef = SET('DEFAULT')" before and "SET DEFAULT TO m.SaveDef) after really do nothing.
Am I missing something?
Thanks in advance,
Joe
Or do what Ted says. :-)
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye Sent: Wednesday, July 20, 2016 4:46 PM To: profoxtech@leafe.com Subject: RE: GETFILE and SET DEFAULT
If you really want to save off the fully qualified path, use a combination of SYS(5) and SYS(2003). The first function gives you the drive letter and the 2nd function gives you the folder hierarchy. It's also the same thing as CURDIR(). So something like this:
m.saveDef=SYS(5)+SYS(2003)
--
rk
I tell ya, the $59.95 I spent on HackFox7 was the best investment of my Fox career!
;)
On Wed, Jul 20, 2016 at 4:47 PM, Richard Kaye rkaye@invaluable.com wrote:
Or do what Ted says. :-)
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye Sent: Wednesday, July 20, 2016 4:46 PM To: profoxtech@leafe.com Subject: RE: GETFILE and SET DEFAULT
If you really want to save off the fully qualified path, use a combination of SYS(5) and SYS(2003). The first function gives you the drive letter and the 2nd function gives you the folder hierarchy. It's also the same thing as CURDIR(). So something like this:
m.saveDef=SYS(5)+SYS(2003)
--
rk
[excessive quoting removed by server]
Whil made you pay for your own copy? For shame...
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Wednesday, July 20, 2016 4:53 PM To: profoxtech@leafe.com Subject: Re: GETFILE and SET DEFAULT
I tell ya, the $59.95 I spent on HackFox7 was the best investment of my Fox career!
;)
On Wed, Jul 20, 2016 at 4:47 PM, Richard Kaye rkaye@invaluable.com wrote:
Or do what Ted says. :-)
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye Sent: Wednesday, July 20, 2016 4:46 PM To: profoxtech@leafe.com Subject: RE: GETFILE and SET DEFAULT
If you really want to save off the fully qualified path, use a combination of SYS(5) and SYS(2003). The first function gives you the drive letter and the 2nd function gives you the folder hierarchy. It's also the same thing as CURDIR(). So something like this:
m.saveDef=SYS(5)+SYS(2003)
--
rk
Well, he said I got the Friends and Family discount...
On Wed, Jul 20, 2016 at 4:56 PM, Richard Kaye rkaye@invaluable.com wrote:
Whil made you pay for your own copy? For shame...
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Wednesday, July 20, 2016 4:53 PM To: profoxtech@leafe.com Subject: Re: GETFILE and SET DEFAULT
I tell ya, the $59.95 I spent on HackFox7 was the best investment of my Fox career!
;)
On Wed, Jul 20, 2016 at 4:47 PM, Richard Kaye rkaye@invaluable.com wrote:
Or do what Ted says. :-)
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Richard Kaye Sent: Wednesday, July 20, 2016 4:46 PM To: profoxtech@leafe.com Subject: RE: GETFILE and SET DEFAULT
If you really want to save off the fully qualified path, use a combination of SYS(5) and SYS(2003). The first function gives you the drive letter and the 2nd function gives you the folder hierarchy. It's also the same thing as CURDIR(). So something like this:
m.saveDef=SYS(5)+SYS(2003)
--
rk
[excessive quoting removed by server]
With Friends and Family like that, who needs a discount? ;-)
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Wednesday, July 20, 2016 4:58 PM To: profoxtech@leafe.com Subject: Re: GETFILE and SET DEFAULT
Well, he said I got the Friends and Family discount...
Hi, Set('Directory') is documented in the updated VFP Helpfile which you can freely download from the VFPX site VFPHelp Edition 1.07 https://vfpx.codeplex.com/wikipage?title=VFP%209%20SP2%20Help%20File&referringTitle=Home Regards, Koen
2016-07-20 23:42 GMT+02:00 Richard Kaye rkaye@invaluable.com:
With Friends and Family like that, who needs a discount? ;-)
--
rk -----Original Message----- From: ProfoxTech [mailto:profoxtech-bounces@leafe.com] On Behalf Of Ted Roche Sent: Wednesday, July 20, 2016 4:58 PM To: profoxtech@leafe.com Subject: Re: GETFILE and SET DEFAULT
Well, he said I got the Friends and Family discount...
[excessive quoting removed by server]
CURDIR() only returns the path and not the drive. If you want both use:
?FULLPATH('')
Peter Cushing IT Department WHISPERING SMITH
On 20/07/2016 21:34, Joe Yoder wrote:
Actually I discovered that my code was disappearing after the commands were executed so I did some more Googling and found that the value to be saved is returned by CURDIR() rather than SET('DEFAULT'). It gets restored with "SET DEFAULT TO." That explains why things weren't working for me! Somehow it seems better terminology could have been chosen!
Thanks,
Joe
This communication is intended for the person or organisation to whom it is addressed. The contents are confidential and may be protected in law. Unauthorised use, copying or disclosure of any of it may be unlawful. If you have received this message in error, please notify us immediately by telephone or email.
www.whisperingsmith.com
Whispering Smith Ltd Head Office:61 Great Ducie Street, Manchester M3 1RR. Tel:0161 831 3700 Fax:0161 831 3715
London Office:17-19 Foley Street, London W1W 6DW Tel:0207 299 7960