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]