Sign in to follow this  
Followers 0
=sinister=

AutoUpdating

10 posts in this topic

I was wonering if there was a script that would make a msgbox come up every 7 days asking if the user wants to update the script (go to a website to check for the update). Hopefully there is, ive been looking forward for a script like this.

Share this post


Link to post
Share on other sites



Doesn't sound to hard: Using @Day and @Hour FileOpen()/FileReadLine()/ FileWriteLine()/ and FileClose() when they first open the .exe, and doing a search from that point on. After 7 days open the msgbox and write the new date with the before mentioned method.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I was wonering if there was a script that would make a msgbox come up every 7 days asking if the user wants to update the script (go to a website to check for the update). Hopefully there is, ive been looking forward for a script like this.

I kinda needed one of these also...so

I whipped one up for us

Dim $Udif, $QT_web = "www.XPCleanMenu.HostRocket.com"

Call("Set_Updater")

;test

$Uask = MsgBox(68, "UpDate Notification", " Your last UpDate was more than " & $Udif & " days ago " & @CRLF & @CRLF & "Would you like to check for new updates now? " & @CRLF & @CRLF)

If $Uask = 6 Then MsgBox(0,"","success... the update was ran ")

Func Set_Updater()

If Not FileExists(@ProgramFilesDir & "\QTasc\XPClean\Settings\UpDate.dat") Then

FileWrite(@ProgramFilesDir & "\QTasc\XPClean\Settings\UpDate.dat", @YDAY)

Else

$Uold = FileReadLine(@ProgramFilesDir & "\QTasc\XPClean\Settings\UpDate.dat", 1)

If $Uold >=320 Then

FileDelete(@ProgramFilesDir & "\QTasc\XPClean\Settings\UpDate.dat")

Return

EndIf

$Udif = @YDAY - $Uold

If $Udif >= 45 Then

$Uask = MsgBox(68, "UpDate Notification", " Your last UpDate was more than " & $Udif & " days ago " & @CRLF & @CRLF & "Would you like to check for new updates now? " & @CRLF & @CRLF)

If $Uask = 6 Then

Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe " & $QT_web)

WinWaitActive("")

EndIf

FileDelete(@ProgramFilesDir & "\QTasc\XPClean\Settings\UpDate.dat")

FileWrite(@ProgramFilesDir & "\QTasc\XPClean\Settings\UpDate.dat", @YDAY)

EndIf

EndIf

EndFunc

you will need to change a few minor things....

web location, file location and 7 days rather than the 45 i put

Hope that helps

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Nice script! I have one question, Do i need the part in the script were you labled "test"?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Where do I put the file location?

Edited by =sinister=

Share this post


Link to post
Share on other sites

I would suggest separating the file location out into one constant for easy manipulation (I hope Valuater doesn't mind my modifying his work):

func setUpdater()

local const $DATA_FILE = @scriptDir & "\update.dat"

local const $WEBSITE = "http://www.update.com/"

local const $DAYS_PAST = 7

local $old, $diff, $button

if not(fileExists($DATA_FILE)) then

fileWrite($DATA_FILE, @YDAY)

else

$old = fileReadLine($DATA_FILE, 1)

if ($old >= (365 - $DAYS_PAST)) then

fileDelete($DATA_FILE)

return

endIf

$diff = @YDAY - $old

if ($diff >= $DAYS_PAST) then

$button = msgBox(0x44, "Update Notification", "Your last update was more than " & $diff & _

" days ago." & @LF & "Would you like to check for new updates now?")

if ($button = 6) then run(@programFilesDir & "\Internet Explorer\iexplore.exe " & $WEBSITE)

fileDelete($DATA_FILE)

fileWrite($DATA_FILE, @YDAY)

endIf

endIfendFunc
Just update the three constants at the top of the function and call it somewhere from your main script.

Share this post


Link to post
Share on other sites

I would suggest separating the file location out into one constant for easy manipulation (I hope Valuater doesn't mind my modifying his work):

Just update the three constants at the top of the function and call it somewhere from your main script.

nice and clean LxP

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I was wonering if there was a script that would make a msgbox come up every 7 days...

Wouldn't it be less resource intensive to have the script launched by the built-in Windows Scheduler every seven days than to have a script running constantly? Just wondering if anyone has checked this out?

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

Wouldn't it be less resource intensive to have the script launched by the built-in Windows Scheduler every seven days than to have a script running constantly? Just wondering if anyone has checked this out?

the script is not running constantly... 8)

my script is only ran (or checked) every time the "real" program is executed

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

the script is not running constantly... 8)

my script is only run (or checked) every time the "real" program is executed

8)

Brilliant! Got it...

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

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  
Followers 0