How to Display Filenames and Retain Upper/Lower Case in File Name
Keywords: askfilename case sensitivity
Question:
I am having trouble with some (not all) filenames changing to uppercase.The AskFileName returns the filenames: Deerskull.pec Lgelpht.pec and N002-005.pec
The AskItemList returns the filenames: Deerskull.pec LGELPHT.PEC and N002-005.PEC
I have also tried using a dialog box to look at the files and select the ones to process (along with option) and I am still ending up with the same thing. I would really like to preserve the case on these file names. Any ideas on what I am doing wrong?
Here is my code:
IntControl(4,0,0,0,0) :SelectDir types= "PEC Files (*.pec)|*.pec|All Design Files (*.pel, *.pem, *.pes,*.pec)|*.pel; *.pem; *.pes; *.pec|Graphics Files (*.gif, *.bmp)|*.gif;*.bmp|All Files (*.*)|*.*|" FileDir=AskFileName("Click on any file to SELECT the ENTIRE DIRECTORY", "d:\", types, "*.pec", 1) Directory=FilePath("%FileDir%") IntControl(4,1,0,0,0) currdir = Directory DirChange("%currdir%") peccnt="0" gotpecs = FileItemize("*.pec") AskItemList("Sorted Files", gotpecs, @tab, @sorted, @single)Answer:
Eeep. Ok. The AskItemList shows the TRUE filenames. To verify this you can start up a MS-DOS prompt and type DIR and see the filenames (on the right).Windows has some code in it to "beautify" filenames it considers "ugly". What it does is (something like) look at the filename, and it is all uppercase, then it will display the filename with an initial uppercase letter and the rest lowercase.
;<----SNIP-----> fn=AskFileName("a file","c:\", "ALL|*.*|", "*.*", 1) Message("AskFileName",fn) truecase=FileItemize(fn) Message("TrueCase",truecase) ;<----SNIP----->FileItemize does return the true unretouched case of the name. The code above will allow you to select a name with AskFileName and then get the true case of the filename (losing the path in the process however).
Article ID: W13232Filename: Display Files in a Dialog with Case Sensitivity.txt