Jump to content

Uninstall Script


Go to solution Solved by T0M50N,

Recommended Posts

Hello,

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=deletered.ico
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
If MsgBox(4, "Confirmation", "Are you sure you want to remove Blizz Video Editor and all of its components?") = 6 Then
    FileDelete(@DesktopDir&"\Blizz Video Editor.lnk")
    DirRemove(@StartMenuDir&"\Programs\Blizz Video Editor", 1)
    DirRemove(@ScriptDir, 1)
    MsgBox(0, "Success", "Program uninstalled successfully.")
Else
    MsgBox(0, "Thanks", "I knew you would make the right decision :)")
EndIf

When I run the script normally it works as expected.

When I run a compiled version of the script, DirRemove(@ScriptDir, 1) no longer works. How can I fix this?

So far I have tried:

Using @WorkingDir instead.

Adding a backslash after @ScriptDir.

Link to comment
Share on other sites

  • Developers

So you want to delete the directory from which the program is running as an EXE?

The running exe will lock the directory as it is in use at the moment of execution,

Look for _SelfDelete() for a way to remove the program after the program completes.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Solution

Found a solution:

Func _SelfDeleteDir($iDelay = 0)
    Local $sCmdFile
    FileDelete(@TempDir & "\scratch.bat")
    $sCmdFile = 'ping -n ' & $iDelay & ' 127.0.0.1 > nul' & @CRLF _
             & ':loop' & @CRLF _
             & 'RD /S /Q "' & @ScriptDir & '"' & @CRLF _
             & 'if exist "' & @ScriptDir & '" goto loop' & @CRLF _
             & 'RD /S /Q %0' & @CRLF _
             & 'del /q /f "%~f0" >nul 2>&1 & exit /b 0' & @CRLF
    FileWrite(@TempDir & "\scratch.bat", $sCmdFile)
    Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE)
EndFunc;==>_SelfDelete

This doesn't leave the scratch.bat in the temp dir either.

Edited by T0M50N
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...