DaLiMan Posted December 13, 2004 Share Posted December 13, 2004 Hi There, Once in a while there a some changes to be made in a script which then is updated on our server. Right now I let my script check this file before it runs completely. This works fine, but it's more in the interest of StartUp speed (it takes quite a while) for the script not to check it every time but more like once a week. Does any of you have a good idea of creating an update checker like this? Thanx. Link to comment Share on other sites More sharing options...
Holger Posted December 13, 2004 Share Posted December 13, 2004 (edited) Maybe you write the current date/time to the registry or a file. Then I would it save in the format YearMonthDayHourMinutesSecond like ie: 20041213133507 (13.12.2004 - 13:35:07) So you can read it at every startup and build a difference and when it is bigger than a week you will do your update things. Or you write a file down and check the file date and also do a difference and when your update process is finished you write this file again. Do you understand what I mean? Regards Holger Edited December 13, 2004 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
sugi Posted December 13, 2004 Share Posted December 13, 2004 (edited) Maybe something like this (untested)? $LastRun=RegRead('HKCU\SOftware\Some\Key', 'xyz', 'REG_SZ') $CurrentRun=Int(@YDAY/7) If $LastRun <> $CurrentRun Then RegWrite('HKCU\Software\Some\Key', 'xyz', 'REG_SZ', $CurrentRun ; Check for update EndIf The trick is that $CurrentRun only changes once a week (=7 days). By setting $CurrentRun=Int(@YDAY/14) you can let it run every two weeks and so on. Two drawbacks: If the script isn't run for exactly one year there won't be any update check and on every beginning of the year the script will check for an update. Edited December 13, 2004 by sugi Link to comment Share on other sites More sharing options...
DaLiMan Posted December 13, 2004 Author Share Posted December 13, 2004 Maybe something like this (untested)?$LastRun=RegRead('HKCU\SOftware\Some\Key', 'xyz', 'REG_SZ') $CurrentRun=Int(@YDAY/7) If $LastRun <> $CurrentRun Then RegWrite('HKCU\Software\Some\Key', 'xyz', 'REG_SZ', $CurrentRun ; Check for update EndIfThe trick is that $CurrentRun only changes once a week (=7 days). By setting $CurrentRun=Int(@YDAY/14) you can let it run every two weeks and so on.Two drawbacks: If the script isn't run for exactly one year there won't be any update check and on every beginning of the year the script will check for an update.<{POST_SNAPBACK}>Yessss, this is really helpfull !!!! Exactly what I was looking for, but couldn't figure out myself. And the problem of NOT running the script for a whole year is extremely neglectable, because if it is not run for that long it is most likely to be obsolete rather than not being used for a while. Thanx a lot ! Link to comment Share on other sites More sharing options...
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