Jump to content

Recommended Posts

Posted

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.
Posted

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!"

Posted

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")
Posted

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!"

Posted

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

Posted

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]
Posted

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.
Posted (edited)

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]

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
  • Recently Browsing   0 members

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