Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use of macro substitution(&) and FILE() at runtime
Message
From
24/01/2000 14:32:34
 
 
To
23/01/2000 20:32:15
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00321491
Message ID:
00321774
Views:
16
>Hi ALL,
> I encountered two problems:
> 1. Use of macro substitution(&) at runtime produce an error while it is alright in command window:
> Copy file &fName to ....
> However, Copy file test.dbf to &fName WORKS

Rule #1 - don't use macro-expansion where it can be avoided, so that spaces and other characters that may be interpreted as separators by the command line parser don't hurt you. In the case above, name expansion avoids the problem quite neatly:

COPY (fname) TO ...


> 2. The use of FILE()fails to tell the existence of a file
> FILE(m_fname) returns FALSE at runtime
> while FILE(m_fname) return TRUE in command window
>

In all probability, the resolution of the path is inconsistent - FILE will return .T. if you use an unqualified path and it can be found anywhere along the current SET PATH setting. ADIR() seems to be less subject to wierdness, and the Scripting.FileSystemObject even less prone to error.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform