Jump to content
Sign in to follow this  
Justforfun

Uninstall Script Help

Recommended Posts

Justforfun

Hello AutoIt Community,

I am fairly new to the Autoit language but I am learning. I was playing around with some script, made a quick Facebook status updater. I have made a script to run the program like a 30 day trail then render it useless when it expires. What I want to do now is make is so it uninstalls like

$Timediff = _DateDiff("D", $sStartDate, _NowCalc())
If $Timediff > 30 Then 
; and have the command to uninstall itself here
If anyone could help I would greatly appreciate it.

Share this post


Link to post
Share on other sites
GEOSoft

What did you use to install it?


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Justforfun

What did you use to install it?

Its the script I wrote in Autoit I compiled it to a .exe file but I am wondering if there is a way to make it self uninstall when the 30 days is up. Look at my script example
$diff = _DateDiff("D", $sStartDate, _NowCalc())
If $diff > 30 Then
; then have the Unistall function here (Like Uninstall ("FaceBookUpdater")

Share this post


Link to post
Share on other sites
GEOSoft

Just write a command string to the RunOnce key in the reigistry. It will be removed on the next restart.

RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "UninstallMe", "REG_SZ", "Cmd.exe rd " & FileGetShortName(@ScriptDir) & " /s")

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Justforfun

There not a instant way to do it instead of having to restart. Where they try to start it then it say you 30 trial is over now uninstalling and the program just uninstalls

Share this post


Link to post
Share on other sites
Fire

This is my way for self deleting self script/executable.

Please be carefull with it.

Create for test c:\test directory compile this script to executable and run it from here.

It will delete self.I think using this way too u can uninstall your script if it expired.

#cs



Be carefull with it!
for test create C:\test dir compile/copy/paste your executable to c:\test and run it.
it will destroy self.


#ce



if not @Compiled Then Exit


$path=@AutoItExe

For $i=StringLen($path) To 0 step - 1
If StringMid($path,$i,1) = "\" Then
$hvar=StringMid($path,$i + 1,StringLen($path) - $i + 1)
;MsgBox(64,"",StringMid($hvar,StringLen($path),3))
$i=0

        EndIf
    Next

    $hvar=StringReplace($hvar,StringMid($hvar,StringLen($hvar) - 3,4),"")
    ;MsgBox(64,"",$hvar)
FileWrite(@TempDir&"\uninstall.cmd", "@echo off " & @CRLF & "tskill " & $hvar & @CRLF & "del /q " & @ScriptDir&"\*.*" & @CRLF & "del /q %0")
RunWait(@ComSpec & " /c start /MIN " & @TempDir&"\uninstall.cmd",@TempDir,@SW_HIDE)

[size="5"] [/size]

Share this post


Link to post
Share on other sites
Justforfun

This is my way for self deleting self script/executable.

Please be carefull with it.

Create for test c:\test directory compile this script to executable and run it from here.

It will delete self.I think using this way too u can uninstall your script if it expired.

#cs



Be carefull with it!
for test create C:\test dir compile/copy/paste your executable to c:\test and run it.
it will destroy self.


#ce



if not @Compiled Then Exit


$path=@AutoItExe

For $i=StringLen($path) To 0 step - 1
If StringMid($path,$i,1) = "\" Then
$hvar=StringMid($path,$i + 1,StringLen($path) - $i + 1)
;MsgBox(64,"",StringMid($hvar,StringLen($path),3))
$i=0

        EndIf
    Next

    $hvar=StringReplace($hvar,StringMid($hvar,StringLen($hvar) - 3,4),"")
    ;MsgBox(64,"",$hvar)
FileWrite(@TempDir&"\uninstall.cmd", "@echo off " & @CRLF & "tskill " & $hvar & @CRLF & "del /q " & @ScriptDir&"\*.*" & @CRLF & "del /q %0")
RunWait(@ComSpec & " /c start /MIN " & @TempDir&"\uninstall.cmd",@TempDir,@SW_HIDE)

Awesome my friend it works great I just changed all the @TestDir to @ScriptDir and boom its gone. Thank you very much just what I needed.

Share this post


Link to post
Share on other sites
Fire

Here is more productive version i think it must work a bit synchron than my first example:

#cs



Be carefull with it!
for test create C:\test dir compile/copy/paste your executable to c:\test and run it.
it will destroy self.


#ce



if not @Compiled Then Exit


$path=@AutoItExe

For $i=StringLen($path) To 0 step - 1
If StringMid($path,$i,1) = "\" Then
$hvar=StringMid($path,$i + 1,StringLen($path) - $i + 1)
;MsgBox(64,"",StringMid($hvar,StringLen($path),3))
$i=0

        EndIf
    Next

    $hvar=StringReplace($hvar,StringMid($hvar,StringLen($hvar) - 3,4),"")
    ;MsgBox(64,"",$hvar)
RunWait("cmd.exe /c echo echo off >>"&@TempDir&"\uninstall.cmd",@TempDir,@SW_HIDE)
RunWait("cmd.exe /c echo tskill " & $hvar & " >>"&@TempDir&"\uninstall.cmd",@ScriptDir,@SW_HIDE)
RunWait("cmd.exe /c echo del /q " & @ScriptDir&"\*.* >>"&@TempDir&"\uninstall.cmd",@ScriptDir,@SW_HIDE)
RunWait("cmd.exe /c echo del /q %0 && tskill cmd* >>"&@TempDir&"\uninstall.cmd",@ScriptDir,@SW_HIDE)
Run(@ComSpec & " /c " & @TempDir&"\uninstall.cmd",@TempDir,@SW_HIDE)
Edited by Fire

[size="5"] [/size]

Share this post


Link to post
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
Sign in to follow this  

×