Jump to content
Sign in to follow this  
supadodger

Keeps Deleting File Now not on Date Specified.

Recommended Posts

supadodger

#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

Share this post


Link to post
Share on other sites
supadodger

i got it

it was the 0

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

should have been

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

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  

×