PDA

View Full Version : Uninstallation debris....



intellogo
04-04-2007, 11:24 AM
When i uninstall my SF7 created installation file, then i am noticing that a file: "uninstall.exe" remains back as debris.

How can i get rid of this.

I don't know any code in SF7...Can any1 please help me out...?

Awaiting ur helpful response....

Eagle
04-04-2007, 02:42 PM
this might be helpfull.

http://www.indigorose.com/forums/showthread.php?t=18331

suggest you have a look at the 'tips' and the example code,
as mentioned, caution should be used with the code, as targets
the 'uninstall folder' and all contents for deletion. plenty testing ;)

same goes for the 'temporary folder' created-used during actual install routines,
to remove 'irsetup.exe' and anything else left in it upon Exit.

this code is 'use at own risk' stuff..just need to be sure don't delete
a folder that should not be deleted :yes

hth

intellogo
04-04-2007, 11:22 PM
Eagle buddy, thanks for showing some appreciation and willingness to help.

But after i went thru ur reply and link. I got the idea but am still unsure abt what code to put in the correct sectioon.

Please could u attach only the necessary imlpememntable code with this post and nothing else...

Awaiting u r reply....

Eagle
04-05-2007, 06:55 PM
try doing this:

copy\paste the functions only into 'Global functions' scripting window:



--Start of Cleanup Functions

function SetTmpLnch()

--to set the target 'runtime' folder and contents to delete

if _DoingUninstall then

strTemplnch = _SourceFolder; -- 'uninstall.exe' parent folder (targetted for deletion) -use caution

else

strTemplnch = _TempLaunchFolder; -- 'irsetup.exe' temp folder targetted for deletion

end

return strTemplnch;

end


function CLNCMD()

--to Set Cleanup Command string to run

-- enclose the target folder in quotes if 'spaces' in the path

if (String.Find(strTemplnch, " ", 1, false) ~= -1) then

strTemplnch = "\""..strTemplnch.."\"";
end

-- set the command arguements to run using a 'no command file' method

local strCmst = "@echo off";
local strCmPause = "ping 127.0.0.1 -n 4 >nul"; --the number 4 is number of seconds to wait before attempting folder deletion(time for the 'runtime' to have closed)
local strCmDel = "if exist "..strTemplnch.." RD /S /Q "..strTemplnch;
local strCmexit = "exit";

--now set the combined command string to run

local strCleanup = "\""..strCmst.."&&"..strCmPause.."&&"..strCmDel.."\"";

return strCleanup;

end

function Cleanup()

-- to call cleanup creation actions and 'Run' the Cleanup

Folder.SetCurrent(_TempFolder);

if ((strTemplnch and (strTemplnch ~= "")) then

local strCleanup = CLNCMD(); --call the command string creator

--if the command string exists, execute it

if strCleanup then

--[[run the created command string to delete the 'runtime' folder and contents(nothing can be 'in use')
using -1 as the 'window mode' to hide command window\taskbar title, with 'wait for return' set to false]]

File.Run(_SystemFolder.."\\cmd.exe", "/C "..strCleanup, "", -1, false);

end
end
end


function Cancel()

--[[function can be usefull eg: when a 'user cancelled' is confirmed
eg to call this function from a 'Cancel button' action use: Cancel(); ]]

Cleanup(); --run the cleanup commands
Application.Exit(5); --exit now

end

--End of Cleanup Functions


now copy\paste the required function calls into the locations as below:


place this in 'On Startup' actions scripting window:


--call the function to set the 'runtime' target folder to delete
SetTmpLnch();


place this as usually the last action in 'On Shutdown' actions scripting window:


--call run the folder delete actions
Cleanup();


note: code works best if you adopt the policy of keeping all 'uninstall' related stuff
out of the %AppFolder% ,as mentioned in the link info.