Folder Path Question - Advanced Installer Community
sylven
Posts: 7
Joined: Fri May 30, 2014 9:39 am

Folder Path Question

I need to know the folder name above the SETUPEXEDIR because I need to place this name in an inifile.
[SETUPEXEDIR] = c:\MySourceFolder\MyApplicationSetupFile\

= c:\MySourceFolder\
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Folder Path Question

Hello,

In order to achieve that you create your own custom action with the above functionality. For example, you can create your custom action as a custom action written in C# or a custom action written in C++.

Then you can go in the “Custom Actions” page and add a predefined Launch attached file custom action with sequence. This type of custom action can execute an application (EXE or DLL) or run a script (VBScript or Java script). Also, the source file will be embedded in the MSI file but will not be deployed at install time with the other application files.

For example, I've used the following code to achieve the desired functionality using the predefined Execute inline script code custom action:

Code: Select all

path = Session.Property("SETUPEXEDIR")
                  
If Right(path, 1) = "\" Then
   pathNew = Left(path, Len(path) - 1)
Else
   pathNew = path
End If

Session.Property("FINAL_PATH") = Left(pathNew, InStrRev(pathNew, "\") )
You can take a look on the VBScript Functions article which may be useful to you.

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”