The condition for a first time install is:
Not Installed
For a complete uninstall:
REMOVE~="ALL"
For any maintenance operation (repair, modify, uninstall, anything except first time install):
Installed
The above came in handy when I ended up wrting this to not display a messagebox on a silent install:
function WarnUserIfNotSilent(hMSI)
STRING szProperty;
NUMBER iSize;
begin
iSize = 256;
if (MsiGetProperty (ISMSI_HANDLE, "UILevel", szProperty, iSize) = ERROR_SUCCESS) then
if (StrCompare(szProperty, "2") != 0) then
MessageBox("A message.", WARNING);
endif;
endif;
end;