I am developing an excel add-in. I have serial numbers(ex. 100 psc) and I want to check when excel add-in installing on pc. But I cant do it with VS2010 setup project because it is not supporting serial number list storing and checking.
so I want to do this with setup factory and I did it like this link: link
but I have a problem excel ;
if I select "Yes", excel working for opening .dll, if select "No", it do anything.
and my setup factory list like this.
and my setup factory "on post install script", my Addinfilename value is "Posta Guvercini Excel AddIn For 2010.dll"
-- Determine registry key (2 = HK CURRENT USER)
sVersions = Registry.GetKeyNames(2, "Software\\Microsoft\\Office");
-- Iterate through the registry keys per MS Office-version
--Next line has SetupFactory 8 code
--for iCount1, sVersion in sVersions do
for iCount1, sVersion in pairs(sVersions) do
-- Try opening the registry key
sSubKey = "Software\\Microsoft\\Office\\"..sVersion..
"\\Excel\\Options\\"
sValues = Registry.GetValueNames(2, sSubKey);
--initialize index counter
iIndex = -2
if sValues then
--Determine the index of the maximimum OPEN registry entry
--Next line has SetupFactory 8 code
--for iCount2, sValue in sValues do
for iCount2, sValue in pairs(sValues) do
if (String.Left(sValue, 4) == "OPEN") then
--Check whether the user did not already install
--the same add-in to prevent errors when opening Excel
sKeysValue = Registry.GetValue(2, sSubKey, sValue, true)
if String.Find(sKeysValue, SessionVar.Expand(
"%AddinFileName%"), 1, false) > 0 then
iIndex = -1
-- leave loop
break;
else
if (sValue == "OPEN") then
iIndex = 0
else
iIndex = String.ToNumber(String.Mid(
sValue, 5, String.Length(sValue)-4))
end;
end;
end;
end;
-- -1 means: This add-in is already installed; we're done
if iIndex ~= -1 then
--Determine path based on variable "%AddinFileName%
sAppPath = String.Char(34)..
SessionVar.Expand("%AppFolder%")..
"\\"..
SessionVar.Expand("%AddinFileName%")..
String.Char(34)
-- -2 is the initialized value of the index counter
if (iIndex == -2) then
-- OPEN-key does not exist
Registry.SetValue(2, sSubKey, "OPEN",
sAppPath, REG_SZ)
else
Registry.SetValue(2, sSubKey, "OPEN"..(iIndex + 1),
sAppPath, REG_SZ)
end;
end;
end;
end;