Claus,
You can increment a registry value without an external script -- I modified Gabriel's idea slightly as you'll see...
Create a search NBR_INSTALLS that obtains the current registry value. Create a "VBScript inline" custom action with this line of code (the conversions to integer and string values are necessary to 1) do the math, and 2) write back to the property):
Code: Select all
session.property("NBR_INSTALLS") = CStr(CInt(session.property("NBR_INSTALLS")) + 1)
Finally, use the registry page to write NBR_INSTALLS back to the registry.
There are a few things to watch out for with this scheme, like the very first install when the reg key doesn't exist, but I added another one-line script to solve that problem (see attached project, which also contains three debug message scripts you can delete).
The logic for decrementing the reg value would be similar. I haven't thought through what happens when the count gets to 0, but I'm not sure you'd need to do anything special. You could just leave the reg key behind on the user's system. That may not be the best policy but it isn't a terrible thing either.
Scott