LordSphynx Posted April 19, 2007 Posted April 19, 2007 I have made a little script that I installed on my server at home. It checks the current version in a webpage and if it is outdated, it updates it automatically. This is the script: FileDelete("C:\temp\version.ini") $version = IniRead("C:\program files\xampp\htdocs\cttime\cttime.ini", "CTTIME", "Version", "") InetGet("http://cttime.flexipoint.be/version.ini", "C:\temp\version.ini", 1) $last_version = IniRead("C:\temp\version.ini", "CTTIME, "Version", "") if $version < $last_version Then FileDelete("C:\program files\xampp\htdocs\cttime\updates\old\CTTIME_Setup.exe") FileMove("C:\program files\xampp\htdocs\cttime\updates\CTTIME_Setup.exe", "C:\program files\xampp\htdocs\cttime\updates\old\CTTIME_Setup.exe", 1) InetGet("http://cttime.flexipoint.be/updates/CTTIME_Setup.exe", "C:\Program Files\xampp\htdocs\cttime\updates\CTTIME_Setup.exe", 1) Run("C:\Program Files\xampp\htdocs\cttime\updates\CTTIME_Setup.exe", "", @SW_HIDE) Sleep(5000) Send("{ENTER}") EndIf Now I want to make this recursive, meaning that I want this to repeat itself every 5 minutes. How do I do that ?
Shevilie Posted April 19, 2007 Posted April 19, 2007 (edited) Keep it in a loop, no need for recursive While 1 FileDelete("C:\temp\version.ini") $version = IniRead("C:\program files\xampp\htdocs\cttime\cttime.ini", "CTTIME", "Version", "") InetGet("http://cttime.flexipoint.be/version.ini", "C:\temp\version.ini", 1) $last_version = IniRead("C:\temp\version.ini", "CTTIME", "Version", "") if $version < $last_version Then FileDelete("C:\program files\xampp\htdocs\cttime\updates\old\CTTIME_Setup.exe") FileMove("C:\program files\xampp\htdocs\cttime\updates\CTTIME_Setup.exe", "C:\program files\xampp\htdocs\cttime\updates\old\CTTIME_Setup.exe", 1) InetGet("http://cttime.flexipoint.be/updates/CTTIME_Setup.exe", "C:\Program Files\xampp\htdocs\cttime\updates\CTTIME_Setup.exe", 1) Run("C:\Program Files\xampp\htdocs\cttime\updates\CTTIME_Setup.exe", "", @SW_HIDE) Sleep(5000) ;I would suggest a WinWait here since that must be a setup you will hit enter in ;And a ControlClick to hit henter Send("{ENTER}") EndIf Sleep(300000) WEnd Edit: Fixed syntax and tap Edited April 19, 2007 by Shevilie Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
LordSphynx Posted April 19, 2007 Author Posted April 19, 2007 Shevilie said: Keep it in a loop, no need for recursive While 1 FileDelete("C:\temp\version.ini") $version = IniRead("C:\program files\xampp\htdocs\cttime\cttime.ini", "CTTIME", "Version", "") InetGet("http://cttime.flexipoint.be/version.ini", "C:\temp\version.ini", 1) $last_version = IniRead("C:\temp\version.ini", "CTTIME", "Version", "") if $version < $last_version Then FileDelete("C:\program files\xampp\htdocs\cttime\updates\old\CTTIME_Setup.exe") FileMove("C:\program files\xampp\htdocs\cttime\updates\CTTIME_Setup.exe", "C:\program files\xampp\htdocs\cttime\updates\old\CTTIME_Setup.exe", 1) InetGet("http://cttime.flexipoint.be/updates/CTTIME_Setup.exe", "C:\Program Files\xampp\htdocs\cttime\updates\CTTIME_Setup.exe", 1) Run("C:\Program Files\xampp\htdocs\cttime\updates\CTTIME_Setup.exe", "", @SW_HIDE) Sleep(5000) ;I would suggest a WinWait here since that must be a setup you will hit enter in ;And a ControlClick to hit henter Send("{ENTER}") EndIf Sleep(300000) WEnd Edit: Fixed syntax and tap Is it normal that this takes 28% of my CPU ???
Shevilie Posted April 19, 2007 Posted April 19, 2007 Well the sleep should take none.. The rest of the code I dont know... Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
Toady Posted April 19, 2007 Posted April 19, 2007 LordSphynx said: Is it normal that this takes 28% of my CPU ???Considering what your code is doing, Yes. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding
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