"Modify / Repair / Uninstall"??...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • WillBellJr
    Forum Member
    • Mar 2006
    • 22

    "Modify / Repair / Uninstall"??...

    I've pretty much finished my installer now (I've enjoyed using SF for creating this installer) and now I'm adding previous installation detection...

    I'm wondering if it's been covered here somewhere how to create the typical installers that startup with the "3-radio button" GUI that offers the selection of Modify / Repair / Uninstall upon launching the installer when the software is already installed on the user's machine??

    In fact, my installer uses another installer (we have an SDK component that uses an MSM (or MSI - this was created by someone else since SF doesn't support them) and that installer (Wise) shows that interface when the SDK component is already installed.

    I'd like my SF installer to sort of do the same.

    I'm not using packages so the "Modify" item may not be necessary but I'm wondering if the uninstaller can be invoked from the installer in this case?

    Does SF7 support this kind of interface?

    Do I have to totally create the interface from scratch (screen button designs and navigation logic) or is there some "prebuilt" stuff that would support doing this?

    Any tips or pointers to previous discussions concerning this would be helpful!

    -Will
  • Brett
    Indigo Rose Staff Member
    • Jan 2000
    • 2001

    #2
    Will, this is definitely possible, however, there is no "built-in" way to do it. Here is some script we use in the Setup Factory 7.0 installer to detect if it is already installed and to prompt the user to uninstall it. Hopefully it will help:

    Code:
    function BreakUninstallStringIntoPathAndCmdLine(strFullString)
    	local strPath = "";
    	local strCmdLine = "";
    	
    	local nPos;
    	
    	nPos = String.Find(strFullString,"\"",2);
    	if(nPos ~= -1)then
    		strPath = String.Left(strFullString,nPos);
    		strPath = String.TrimLeft(strPath,"\"");
    		strPath = String.TrimRight(strPath,"\"");
    		
    		strCmdLine = String.Right(strFullString,String.Length(strFullString)-nPos);
    		strCmdLine = String.TrimLeft(strCmdLine," ");
    		strCmdLine = String.TrimRight(strCmdLine," ");
    	end
    	
    	return strPath, strCmdLine;
    end
    
    local strInstallDir = Registry.GetValue( HKEY_CURRENT_USER
                                           , SessionVar.Expand("Software\\Indigo Rose\\%ProductName%")
                                           , "InstallDir" );
    
    if(strInstallDir ~= "")then
    	-- See if the uninstall regsitry key is there
    	local strKeyName = SessionVar.Expand("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%ProductName%");
    	local bKeyExists = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE,strKeyName);
    	if(bKeyExists)then
    		local strUninstallString = Registry.GetValue(HKEY_LOCAL_MACHINE,strKeyName,"UninstallString");
    		if(strUninstallString ~= "")then
    			local strPath, strCmdLine = BreakUninstallStringIntoPathAndCmdLine(strUninstallString);
    			if(File.DoesExist(strPath))then
    				-- OK to uninstall...
    				local strMsg = SessionVar.Expand(
    								 "Setup has detected that %ProductName% is already installed.\r\n");
    				strMsg = strMsg.."Would you like to uninstall the existing copy before continuing?";
    				
    				local nResult = Dialog.Message("Existing Installation Detected",strMsg,MB_YESNO,MB_ICONQUESTION);
    				if(nResult == IDYES)then
    					-- Run the uninstall
    					local nRunResult = File.Run(strPath,strCmdLine,"",SW_SHOWNORMAL,true);
    					if(Application.GetLastError() ~= 0)then
    						Dialog.Message("Error","An error occurred while running the uninstall:\r\n".._tblErrorMessages[Application.GetLastError()]);
    					end
    				end
    			end
    		end
    	end
    end

    Comment

    • WillBellJr
      Forum Member
      • Mar 2006
      • 22

      #3
      Hi Brett, thanks for the code.

      I guess I can adopt this scheme as well - I don't really need the Modify or Repair options, I can just ask as you do if an uninstall is desired and just run that if selected...

      Thanks for your help!

      -Will

      Comment

      • Tomas
        Forum Member
        • May 2006
        • 4

        #4
        hi Brett,

        I don't need the Modify or Repair options too,

        can you attach a sample SUF 7.0 project that check for an old installation with these codes in this topic ?

        thanks

        Comment

        • Brett
          Indigo Rose Staff Member
          • Jan 2000
          • 2001

          #5
          The above does onlythe uninstall. It does not do the repair or modify.

          Comment

          • Tomas
            Forum Member
            • May 2006
            • 4

            #6
            ok !
            that is what i need !

            but i can not use above codes in my setup project !

            whould you please explain where can should i use the codes or attach a sample project for me ?

            Comment

            • WillBellJr
              Forum Member
              • Mar 2006
              • 22

              #7
              The code worked for me?? What problems are you having?

              I created a screen ("Previous Installation Detected") and placed that BEFORE the first screen (welcome)

              On the preload action, I perform my checks for an already existing installation (I added some specific registry keys even though I don't need them)

              If an installation exists, I use code following what's outlined above.

              -Will

              Comment

              • davels
                Forum Member
                • Feb 2007
                • 43

                #8
                I just have look your solution but I don't understand the following

                Code:
                local strInstallDir = Registry.GetValue( HKEY_CURRENT_USER
                                                       , SessionVar.Expand("Software\\Indigo Rose\\%ProductName%")
                                                       , "InstallDir" );
                I just look on my computer test and I have nothing in this registry key, I only have something on my computer where are installed Indigo Rose product.

                Comment

                Working...
                X