Jump to content

AutoUpdating


=sinister=
 Share

Recommended Posts

  • Moderators

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.

Link to comment
Share on other sites

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

Link to comment
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.
Link to comment
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
Link to comment
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

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