Jump to content

Simple Notepad Installer


JustinReno
 Share

Recommended Posts

I have been creating an installer/uninstaller for my Simple Notepad.

What it does:

Installer:

Fileinstalls the uninstaller to the windows directory, fileinstalls simple notepad to its directory. Created the Desktop icon if wanted.

Uninstaller:

Closes Simple Notepad's process if running, reads the ini file the installer created(the ini contains the installation path), then deletes the installation path, which would delete the program, then deletes all the other desktop icons created.

The problem is the uninstaller; it doesn't delete my installation path where the program resides

The ini is in C:\WINDOWS\unsnw.ini. the ini reads as:

CODE

[Location]

SN=C:\Program Files\Simple Notepad

here is the uninstall stuff:

CODE

$UninstallMSG = MsgBox(20, "Uninstall Simple Notepad", "Are you sure you want to uninstall Simple Notepad?")

If $UninstallMSG = 6 Then

ProcessClose("Simple Notepad.exe")

$UniniRead = IniRead("C:\WINDOWS\unsnw.ini", "Location", "SN", "")

MsgBox(0, "Testing!", "" & $UniniRead & "")

DirRemove($UniniRead, 1)

FileDelete(@DesktopDir & "\Simple Notepad.lnk")

FileDelete(@DesktopDir & "\Uninstall Simple Notepad.lnk")

FileDelete("C:\WINDOWS\unsnw.ini")

MsgBox(64, "Uninstall Simple Notepad", "Done! All you have to do is delete this installer at C:\WINDOWS\Uninstall Simple Notepad.exe")

EndIf

If $UninstallMSG = 7 Then

Exit

EndIf

I really need help! I tried everything I could do, please please!

Link to comment
Share on other sites

Try to replace the content of ini file to see what's happening:

[Location]
SN=C:\Progra~1\Simple~1

Also you can try to run this:

$UninstallMSG = MsgBox(20, "Uninstall Simple Notepad", "Are you sure you want to uninstall Simple Notepad?")
If $UninstallMSG = 6 Then
ProcessClose("Simple Notepad.exe")
$UniniRead = IniRead("C:\WINDOWS\unsnw.ini", "Location", "SN", "")
MsgBox(0, "Testing!", "" & $UniniRead & "")
if DirRemove($UniniRead, 1) then
   MsgBox(0, "Success", "Folder Removed")
else
  MsgBox(0, "Error", "Cannot remove folder")
endif
FileDelete(@DesktopDir & "\Simple Notepad.lnk")
FileDelete(@DesktopDir & "\Uninstall Simple Notepad.lnk")
FileDelete("C:\WINDOWS\unsnw.ini")
MsgBox(64, "Uninstall Simple Notepad", "Done! All you have to do is delete this installer at C:\WINDOWS\Uninstall Simple Notepad.exe")
EndIf
If $UninstallMSG = 7 Then
Exit
EndIf

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Seems to work here... I created the directory and put some random files in it.

It works... maybe you should check the directories' attributes...

Oh and why don't you use macros? It won't work in computers that have a different Windows directory.

I also think that putting the unistaller in the Windows directory isn't a good idea. Why not use the program's folder?

Link to comment
Share on other sites

Inno Setup works well, but if anyone would like to try, or prove me wrong and its just me why it doesn't work; here are the in(un)staller codes:

Compile the Uninstaller as Uninstall Simple Notepad.exe because the Installer will be fileinstalling the uninstaller.

Installer:

CODE

#include <GUIConstants.au3>

FileInstall("Simple Notepad.exe", @TempDir & "\Simple Notepad.exe")

FileInstall("Uninstall Simple Notepad.exe", @TempDir & "\Uninstall Simple Notepad.exe")

$Form1 = GUICreate("Simple Notepad Installer 1.0", 273, 130, 193, 115)

$Label1 = GUICtrlCreateLabel("Welcome to Simple Notepad's Installer!", 0, 0, 188, 17)

$Label2 = GUICtrlCreateLabel("Place to Install:", 0, 32, 76, 17)

$Input1 = GUICtrlCreateInput("C:\Program Files\Simple Notepad", 0, 48, 185, 21)

$Checkbox1 = GUICtrlCreateCheckbox("Shortcut on the Desktop.", 0, 80, 145, 17)

$Button1 = GUICtrlCreateButton("Install", 0, 104, 75, 25, 0)

$Button2 = GUICtrlCreateButton("About", 80, 104, 75, 25, 0)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

$ReadInstallPath = GUICtrlRead($Input1)

$WriteUn = IniWrite("C:\WINDOWS\unsnw.ini", "Location", "SN", $ReadInstallPath)

$ReadDesktopShortcut = GUICtrlRead($Checkbox1)

DirCreate($ReadInstallPath)

FileCopy(@TempDir & "\Simple Notepad.exe", $ReadInstallPath)

FileCopy(@TempDir & "\Uninstall Simple Notepad.exe", "C:\WINDOWS\Uninstall Simple Notepad.exe")

If $ReadDesktopShortcut = $GUI_CHECKED Then

FileCreateShortcut($ReadInstallPath & "\Simple Notepad.exe", @DesktopDir & "\Simple Notepad.lnk", -1, -1, -1, $ReadInstallPath & "\Simple Notepad.exe")

EndIf

FileCreateShortcut(@WindowsDir & "\Uninstall Simple Notepad.exe", @DesktopDir & "\Uninstall Simple Notepad.lnk", -1, -1, -1, "C:\Windows\IsUninst.exe")

$DoneMSG = MsgBox(68, "Simple Notepad Installer", "Done! Do you want to start Simple Notepad?")

If $DoneMSG = 6 Then

ShellExecute($ReadInstallPath & "\Simple Notepad.exe")

Exit

EndIf

If $DoneMSG = 7 Then

Exit

EndIf

EndSwitch

WEnd

Uninstaller:

CODE

$UninstallMSG = MsgBox(20, "Uninstall Simple Notepad", "Are you sure you want to uninstall Simple Notepad?")

If $UninstallMSG = 6 Then

ProcessClose("Simple Notepad.exe")

$UniniRead = IniRead("C:\WINDOWS\unsnw.ini", "Location", "SN", "")

MsgBox(0, "Testing!", "" & $UniniRead & "")

If DirRemove($UniniRead, 1) Then

MsgBox(0, "Success", "Folder Removed")

Else

MsgBox(0, "Error", "Cannot remove folder")

EndIf

FileDelete(@DesktopDir & "\Simple Notepad.lnk")

FileDelete(@DesktopDir & "\Uninstall Simple Notepad.lnk")

FileDelete("C:\WINDOWS\unsnw.ini")

MsgBox(64, "Uninstall Simple Notepad", "Done! All you have to do is delete this installer at C:\WINDOWS\Uninstall Simple Notepad.exe")

EndIf

If $UninstallMSG = 7 Then

Exit

EndIf

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...