Silentfury
Posts: 2
Joined: Mon Dec 05, 2005 2:51 pm

Registry problem with \

I need help with something that I can't seem to resolve on my own. I made an installer recently, with the ability to add to the registry after installation. For the "Install Path" string I used [APPDIR], so it could be added automatically. The problem I have is that after installation for the "Install Path" string it reads "C:\MyApp\Example\" When I want it to be "C:\MyApp\Example" without the \. So how can the info be added into the registry without the slash mark at the end?
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hello,

This can be done using a Custom Action.

1. Create a new text file, say scr.vbs, with the following content:

Code: Select all

Function Main
   Dim filespec
   filespec = Session.Property("APPDIR")
   filespec = Left(filespec, Len(filespec) - 1)
   Session.Property("INSTPATH") = filespec
End Function
2. On the Custom Actions page, select from the toolbar: Show Standard Action -> Before Finalization -> RegisterMIMEInfo. You could use any Standard Action executed before WriteRegistryValues.

3. Add a New Attached Custom Action to RegisterMIMEInfo item and select the VBS script you created previously.

4. In the Function Name field type Main.

4. Switch to the Registry page and set the Data field of your Install Path entry to [INSTPATH]. This property is created by the above script by removing the trailing backslash from [APPDIR].

Hope this helps.

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
Silentfury
Posts: 2
Joined: Mon Dec 05, 2005 2:51 pm

Fantastic! Perfect. Thank you for the quick response. I did exactly what you told me to do and presto, worked perfect. Thank you for the clear, concise instructions!

Return to “Common Problems”