Harish
Posts: 35
Joined: Tue Dec 27, 2005 9:25 am

How to register the regfile

Hi,

we have .reg file and it needs to be installed. I mean if we doubleclick on that it will write into registry.

From command line it can be achieved by regedit /s xxx.reg

How can this be achieved using Advanced Installer.

Thanks,
Harish.Y
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi,

Currently Advanced Installer does not support importing ".reg" files. This will be available in a future release. Until then, you have 2 alternatives:
- manually enter the registry data from the ".reg" file in the Registry page of AdvInst
- use a Custom Action that will "execute" the ".reg" file at install time

In what follows I shall explain the second approach:

1. In the Files and Folders page, add the ".reg" file in question to your project.

2. In the Custom Actions page, add a Property Set with Formatted Custom Action on the "InstallFinalize" stage. Set the following settings for this CA:
- Property Name : REGFILE
- Formatted Text: [#regfile.reg] (select the file from your package by clicking the "Edit" button and then the "File" button in the "Edit Custom Action Properties Parameters" dialog).

3. Create a new text file ("ImportRegFile.vbs") and copy the following code into it:

Code: Select all

strRegFile = Session.Property("REGFILE")
LaunchSomething(strRegFile),True 

Function LaunchSomething(strPath, bWait)
  Set WshShell = CreateObject("WScript.Shell")
  strCmd = chr(34) & strPath & chr(34) 
  ' MsgBox strCmd
  ret = WshShell.Run(strCmd, 1, bWait)
End Function
4. Create a New Attached Custom Action scheduled on the "InstallFinalize" stage, after the previously defined Property Set with Formatted CA. Select the VBScript file created previously. Set the following properties for this CA:
- Function Name: (Must be blank)
- Execution Condition: (Not Installed)

Please note that if the ".reg" file is imported in this manner, the registry entries it contains will not be removed when the application is uninstalled.

Regards,
Denis
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”