Retreiving Short Filenames

Chris Kelleher

Administrator
Staff member
James-

Hi there. Are you talking about getting the short filename or using that name? The tilde (~) character has special meaning in Progress, so you need to use two like this: "Progra~~1".

HTH.

-Chris

------------------
Chris Schreiber
ProgressTalk.com Manager
chris@fast4gl.com
 

jamesmc

Member
Hi Chris,

What I want to do is use the system-dialog to retrieve a filename (long or short) then if it is a long file anme, convert it to its short named version and then save it into a database.

I realise that the ~ character is a special character but I know there is a WinAPI called GetShortPathName that might do the trick but I don't know how to get that to work!

Any help or advice would be appreciated.

Thanks,

James.


<BLOCKQUOTE><font size="1" face="Arial, Verdana">quote:</font><HR>Originally posted by progresstalk:
James-

Hi there. Are you talking about getting the short filename or using that name? The tilde (~) character has special meaning in Progress, so you need to use two like this: "Progra~~1".

HTH.

-Chris

<HR></BLOCKQUOTE>
 

jamesmc

Member
All,

I have sort of resolved the problem that I was having earlier. The problem was that I couldn't open a document witha long file name into word or excel etc. I have now found out that it isn't the fact that it is a long file name, is is because the filename has got spaces in it! (and I have tried opening a document with 17 characters before the extension so it is still a long file name).

What I am going to have to do as an immediate solution is replace all of the spaces in a files name with _

If anyone can find a solution I would be most grateful.

Thanks,

James.
 

Chris Kelleher

Administrator
Staff member
James-

When using long filename with spaces, you need to make sure the entire filename in contained within quotes, else Windows will think there are several different files, instead of one.

Of course, replacing spaces with an underscore will do the trick as well.

HTH.

-Chris

------------------
Chris Schreiber
ProgressTalk.com Manager
chris@fast4gl.com
 

jamesmc

Member
Chris,

True, but the idea is for the user to select a file from a system-dialog. I then store that filename in the database for use later. If the user ever double clicks on the filename I want to autoload the application and the file.

The only way I can use double quotes is if I hardcode the file name into the program, I can't do, for example:

find last document NO-LOCK.
ShellExecute("open", document.doc-path).

I could do:

ShellExecute("open", "c:\james\my file.doc").

This works fine.

I think for the time being I am going to just replace all of the spaces with an underscore.

Thanks for all of your time.

James.
 

Chris Kelleher

Administrator
Staff member
James-

I think this should solve your problem nicely:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
find last document NO-LOCK.
ShellExecute("open", "~"" + document.doc-path + "~"").
[/code]

HTH.

-Chris



------------------
Chris Schreiber
ProgressTalk.com Manager
chris@fast4gl.com
 
Top