Jump to content

Keeps Deleting File Now not on Date Specified.


Recommended Posts

#include <Date.au3>

Local $nowdate = _NowDate()

;$t = FileGetTime(MyApp.exe", 1)

;$yyyymd = $t[1] & "/" & $t[2] & "/" & $t[0]

if FileExists ("MyApp.exe") Then

Call ("CheckDate")

Else

ShellExecute ("http://www.MyWebsite.com/MyApp")

EndIf

Func CheckDate()

if $nowdate > "02/27/2009" Then

ProcessClose ("MyApp.exe")

FileDelete ("MyApp.exe")

Call ("_SelfDelete")

Else

Run ("MyApp.exe")

ENDIF

ENDFunc

Func _SelfDelete($iDelay = 0)

Local $sCmdFile

FileDelete(@TempDir & "\scratch.bat")

$sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _

& ':loop' & @CRLF _

& 'del "' & @ScriptFullPath & '"' & @CRLF _

& 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _

& 'del ' & @TempDir & '\scratch.bat'

FileWrite(@TempDir & "\scratch.bat", $sCmdFile)

Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE)

ShellExecute ("http://www.stealingthemblind.com/MyApp")

EndFunc

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