Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS Common Dialog - is there a way to return Path and lis
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00299346
Message ID:
00299488
Views:
19
George,

It seems to me that I found a solution by myself. It's not easy and elegant, but should work. It requeres one assumption (but I don't think it makes a serious limitation): all files, which we consider, should have an extension, e.g.:
file.ext

In this case I need:
1) Find a first '.'
lcItems=oDialog.FileName
lcString=left(lcItems,at('.',lcItems)-1)
2) Find a last space in lcString:
lnPos=rat(' ',lcString)
lcPath=LEFT(lcString,lnPos-1)
3) Parse reminder to filenames
lcListFiles=alltrim(strtran(lcItems,lcPath,'')) && Should substitute LcPath with ''

So, this is my plan.


>The following should help:
>* Save the file name to a variable
>lcfilename = oDialog.FileName
>lnpt = AT(CHR(0), lcfilename)
>IF lnpt > 0
>  lcpath = LEFT(lcfilename, lnpt - 1)
>  lcfilename = SUBSTR(lcfilename, lnpt + 1)
>  lnfiles = OCCURS(CHR(0), lcfilename) + 1
>  DIMENSION a_file[lnfiles]
>  lni = 0
>  DO WHILE NOT EMPTY(lcfilename)
>    lni = lni + 1
>    lnpt = AT(CHR(0), lcfilename)
>    IF lnpt > 0
>      lcname = LEFT(lcfilename, lnpt - 1)
>    ELSE
>      lcname = lcfilename
>      lcfilename = ""
>    ENDIF
>    a_file[lni] = lcname
>  ENDDO
>ENDIF
This will parse the name. The path will be in the lcpath variable, and the file names stored in the a_file array.
>
>hth,
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform