how to insert the installation path into a file? - 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!

fly77
Posts: 2
Joined: Wed May 02, 2007 4:37 pm

how to insert the installation path into a file?

Hi all,

I've very very new to Advanced Installer and have a question.

The problem is, one of the files I'm installing needs to know the location of the installation.

For example:
In my 'config' file, I have a setting:
LOCATION := "C:\ProgramFiles\MyApp\"

But this is no good if the user decides, when running the installer, to install the application somewhere else (the LOCATION setting would now be wrong).

So I want to be able to get the installation path that the user has selected, then write this path into my config file (using some find/replace method for a known variable name).

Does this make sense? Has anyone tried to do something like this before?

Any pointers would be much appriciated!

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

Hi Fly,

This is usually done by using a INI file. So in the "Files and Folders" page choose "New INI file" from context menu (you need to have a component added in order to create a INI file). Add a "New Entry" with [APPDIR] as value (APPDIR property points to the installation folder).

After insalation the INI file will look like this:

Code: Select all

[New Section]
Location=C:\Program Files\Your Company\Your Application\
If you don't want a INI file then you need to write your own custom action to find and replace a string in a file. To access a property in a VBS custom action you can use this code:

Code: Select all

strValue = Session.Property("APPDIR")
Hope this helps.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
fly77
Posts: 2
Joined: Wed May 02, 2007 4:37 pm

Thanks so much for your help,
that's exactly what I was looking for!

:)

Return to “Common Problems”