Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Increase/ Decrease ViewScale Property of a Flash Member
Font Pages
MPEG Xtra Controller Button
ZGTSB-ButtonDown
Shocking the Web : Windows
Add Your file to windows Startup
List Inspector 1.1 with Tree View
APresentationTrakker Xtra
Gravitational Force
Director and Flash Training (and more) on CD
 

 

 

Article The Complete Uninstall

Added on 7/23/2000

 

Compatibilities:
D7 D8 PC

This item has not yet been rated

Author: EmmanuelNedelec

How do I create an uninstaller that doesn’t leave anything on the hard disk ?

Even if an application (the uninstaller) is moved to the trash directory when closed, the system won’t let it be launched from there.

Another approach is to change the AUTOEXEC.BAT so that at next start-up the uninstaller would be deleted, but following start-ups would then have a dos error message. Besides, it isn’t so smart towards antivirus programs.  

In macromedia.director.lingo newsgroup, Tomasz Wisniewski gave the clue writing about wininit.ini file. This file can be created in WINDOWS directory, it is automatically read at next system start-up by wininit.exe (a 16 bit application) and then automatically renamed to wininit.bak.

Search for this last one on your computer, there are many chances you find it no matter your Windows version is. You can read it with Windows’ notepad, and may find in it old instructions concerning the last setups you made.

To delete a file using this “only-once-executed” method, you just have to rename it to NULL (empty)  string. So the content of the wininit.ini file just needs to be, for example :




[rename]
NUL=C:\WINDOWS\My_Del.EXE



assuming that My_Del.EXE is the name of our uninstall-projector.

You can rename or delete as many files as you want, as long as you name them using the DOS “8.3” filename format.

This format restriction is a small problem because there is no way to get it for a file without using non-freeware xtra, except with the “two free functions” feature of BuddyAPI Xtra.



That’s why in the example below I suggest to put the uninstaller in the root directory of C: drive before activating it. I also consider that the uninstaller is named My_Del.EXE, and that it works with a text file My_Del.log containing the list of the files to be deleted. This kind of log file are often generated by the installer application. Let’s say that ours contains something like :



My_Del.log :

C:\Program Files\My_Folder\My_projector.exe
C:\Program Files\My_Folder\My_Del.exe
C:\Program Files\My_Folder\My_Del.log
C:\Program Files\My_Folder\Xtras\pomlite.x32
C:\Program Files\My_Folder\Media\image1.jpg
C:\Program Files\My_Folder\Media\
C:\Program Files\My_Folder\Xtras\
C:\Program Files\My_Folder\


You can notice that the folder names are also present, in the invert hierarchical order (last 3 lines). This is to be able to delete them also.

A last little problem to avoid is lingo’s confusion between the root directory of a drive and the current directory : asking an application somewhere in the disk to open its copy on the root of the same disk brings you to see it opening itself, and not its copy. An issue to this is to rename the copy : the “open” command won’t make the confusion anymore.

That’s why in the example you can see I rename My_Del.exe to My_Del2.exe , and its log file also (but this one only to stay logical)...

The script of the uninstaller can be contained in a single frame script, as follows :

My_Del.dir, first and only frame script

on exitFrame
if the moviePath = "C:\" then
unInstallFiles ()
removeUninstaller ()
else
copyToTheRoot ()
open ("C:\my_del2.exe")
end if
quit
end

--------------
on CopyToTheRoot
-- copies & rename the uninstaller and
-- its log file to C: root,
-- and launches the uninstaller copy
-- uses FileXtra to do this
-- Renaming is to avoid lingo bugging
-- confusing root & current directory
-- for next open
copyFile (the moviePath & "my_del.exe", "c:\my_del2.exe")
copyFile (the moviePath & "my_del.log", "c:\my_del2.log")
end
--------------
on unInstallFiles
-- deletes what's indicated
-- in the log file
-- uses fileIO & FileXtra
set lineFeedChar = NumToChar (10)
set logFile = new (xtra "fileIO")
openFile (logFile, "c:\my_del2.log", 1)
set myFileNames = ReadFile (logFile)
CloseFile (logFile)
set logFile = 0
repeat with i = 1 to the number of lines in myFileNames
set myName = line i of myFileNames
if char 1 of myName = lineFeedChar then
-- this is to delete the lineFeedChar present in PC text files
set myName = chars (myName, 2, the number of chars in myName)
end if
if the number of chars in myName > 3 then
-- myName contains more than "x:\"
if the last char in myName <> "\" then
-- myName is a file name
set retour = deleteFile (myName)
else
-- myName is a directory name
set retour = deleteDirectory (myName)
end if
end if
end repeat
end
--------------
on removeUninstaller
-- sets wininit.ini file
-- in windows directory
-- so that it removes the
-- uninstaller at next startup
-- uses fileIO
set CRLFchar = RETURN & numToChar (10)
set myText = "[rename]" & CRLFchar & "NUL=c:\my_del2.exe" & CRLFchar & "NUL=c:\my_del2.log"
set iniName = getOSDirectory () & "\wininit.ini"
set iniFile = new (xtra "fileIO")
createFile (iniFile, iniName)
openFile (iniFile, iniName, 2)
WriteString (iniFile, myText)
CloseFile (iniFile)
set iniFile = 0
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail