Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get file name only
Message
From
23/05/2014 11:26:19
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01600582
Message ID:
01600587
Views:
53
>>>Hi,
>>>
>>>How do you find the file name only, returned by GetFile() function; without the path to the file?
>>>
>>>TIA
>>not direct but
>>
>>?justfname(getfile())
>>/pre>
>>should do the work
>>
>>if you insist on GetFile the following will work
>><pre>
>>#DEFINE GETFILE MyGetFile
>>
>>?GETFILE()
>>
>>FUNCTION MyGetFile
>> LPARAMETERS;
>>  cFileExtensions,;
>>  cText,;
>>  cOpenButtonCaption,;
>>  nButtonType,;
>>  cTitleBarCaption
>>
>> #UNDEFINE GETFILE
>>
>> lvTemp = PCOUNT()
>> DO CASE
>>  CASE lvTemp=0
>>   lvTemp = JUSTFNAME(GETFILE())
>>  CASE lvTemp=1
>>   lvTemp = JUSTFNAME(GETFILE(cFileExtensions)
>>  CASE lvTemp=2
>>   lvTemp = JUSTFNAME(GETFILE(cFileExtensions,cText))
>>  CASE lvTemp=3
>>   lvTemp = JUSTFNAME(GETFILE(cFileExtensions,cText,cOpenButtonCaption))
>>  CASE lvTemp=4
>>   lvTemp = JUSTFNAME(GETFILE(cFileExtensions,cText,cOpenButtonCaption, nButtonType))
>>  CASE lvTemp=5
>>   lvTemp = JUSTFNAME(GETFILE(cFileExtensions,cText,cOpenButtonCaption, nButtonType,cTitleBarCaption))
>>  OTHERWISE
>> ENDCASE
>>
>> RETURN lvTemp
>>ENDFUNC &&MyGetFile
>>
>
>Thank you. But with all due respect; seems like over-kill. I can get the file with GetFile() and then simply get the file name by applying justfname().

I was just kidding :)

An other way would be to use ctl32 with the newer style dialogs. This will return filename only in some of its properties.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform