Link to home
Start Free TrialLog in
Avatar of Raynovac
Raynovac

asked on

Inno Registry write String value that is last of Sequence

I am working with inno setup and I need to write a string value to HKCU\Software\Microsoft\Office\12.0\Excel\Options.  

This is to force the check in the excel addins.  The problem is that the keys are sequential i.e.
OPEN
OPEN1
OPEN2


Can someone assist me in finding the last OPEN and then assigning it to he registry line.
If that is not possible, should I use the code to write it to the registry and skip useing the registry block?

Also, this is the first time I have used pascal.  My coding experience is in other languages.

Here is the Inno script so far
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "DA Toolbox"
#define MyAppVersion "DA ToolBox 1.0"
#define MyAppPublisher "KKB"
#define MyAppURL "http://www.kkbcpa.com/"
#define MyAppExeName "MyProg.exe"
#define MyOfficeApplication "Excel"
#define MyAppRegistryRoot "HKCU"
#define MyAppFileName "Excel Toolbox 2013.xlam"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{D9E617D4-08B6-41FC-ABD3-F83CBA722736}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
CreateAppDir=no
OutputDir=F:\System Repository\Utility\_Applications\DA Toolbox\Code\Installer
OutputBaseFilename=setup_DA_Toolbox_v1.0
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "F:\System Repository\Utility\_Applications\DA Toolbox\Code\Source\{#MyAppFileName}"; DestDir: "{userappdata}\Microsoft\AddIns"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files




[Registry]
Root: {#MyAppRegistryRoot}; Subkey: Software\Microsoft\Office\12.0\{#MyOfficeApplication}\Options; ValueType: string; ValueName: OPEN; ValueData: """{#MyAppFileName}"""; Flags: uninsdeletevalue;

 ; find the OPEN reg entry to get the most recent count and then add it
[Code]
For I:=1 to 100 do
    begin
    if not(RegValueExists({#MyAppRegistryRoot}, 'Software\Microsoft\Office\12.0\{#MyOfficeApplication}\Options', Concat('OPEN',I))) then
      begin
      // The value exists
      end;
    end;

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Raynovac
Raynovac

ASKER

Thanks.