Long File Names to Short - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Greg
Posts: 2
Joined: Sat Oct 07, 2006 7:02 pm

Long File Names to Short

Hi,

I created a new INI file with 2 key values to return [AppDir]+[Source Dir]
and they return in long file names.(eg. C:\Program Files\MyProgram)I need them to return in short file names.(eg.C:\PROGRA~1\MYPROG~1)What is the best way to do this?

Thanks.
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

You can obtain the short names only for files not for folders. To obtain the short name of a file use this formatted: [!filekey] where the filekey is a key in the File table. Also note that this works only when it's used in the Value column of the Registry or IniFile tables.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Greg
Posts: 2
Joined: Sat Oct 07, 2006 7:02 pm

Hello again,

Thank you for the respose to my problem.I tried what you suggested
"[!filekey]" and it didn't work.Resultslongfilenames.This it what I did just to make sure I did it right.I created a new INI file,New Section named "directories". Then I created New Key and Inserted refrence to a file and for value used "[!filekey]".Results came back longfilenames.I even tried for the value Insert refrence to windows installer properties\Configuation\Shortfilenames and got the same results so this approach won't work for me.
I was wondering if a script would work?Even though I never wrote a script in my life I'd give it a go with some guideance.
This is what I need to accomplish:
1-Get the value of the [APPDIR].
Sesssion.Property("APPDIR") = "Value1"
2-Get the value of [SOURCEDIR]
Sesssion.Property("SOURCEDIR") = "Value2"
3-Convert value to [SHOTFILENAMES]
strProperty = Sesssion.Property("SHORTFILENAMES")
Create a file (Myprog.cfg) with a section [directories]
and 2 keys InstallFromDir=[SOURCEDIR] eg: G:\MYPROG~1
InstallToDir=[APPDIR] eg: C:\PROGRA~1\MYPROG~1
Any help with this would be greatly appericated and thank you again for your response.

Greg
Phobos
Posts: 85
Joined: Fri Sep 08, 2006 11:52 am
Location: Germany

Hi Greg,

I'm not sure if this will help you, but to get a short path you could use a script like this:


APPLICATION = Session.Property("APPDIR")

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(APPLICATION)

SHORT = objFolder.ShortPath

MsgBox SHORT

Return to “Common Problems”