=sinister= Posted September 17, 2005 Posted September 17, 2005 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.
Moderators SmOke_N Posted September 17, 2005 Moderators Posted September 17, 2005 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.
Valuater Posted September 17, 2005 Posted September 17, 2005 (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 usDim $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) EndIfEndIfEndFuncyou will need to change a few minor things....web location, file location and 7 days rather than the 45 i putHope that helps8) Edited September 18, 2005 by Valuater
=sinister= Posted September 18, 2005 Author Posted September 18, 2005 Nice script! I have one question, Do i need the part in the script were you labled "test"?
=sinister= Posted September 18, 2005 Author Posted September 18, 2005 (edited) Where do I put the file location? Edited September 18, 2005 by =sinister=
LxP Posted September 18, 2005 Posted September 18, 2005 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.
Valuater Posted September 18, 2005 Posted September 18, 2005 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 LxP8)
jefhal Posted September 18, 2005 Posted September 18, 2005 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
Valuater Posted September 18, 2005 Posted September 18, 2005 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 executed8)
jefhal Posted September 18, 2005 Posted September 18, 2005 the script is not running constantly... 8)my script is only run (or checked) every time the "real" program is executed8)Brilliant! Got it... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now