Sign in to follow this  
Followers 0
LordSphynx

Need help making it recursive

5 posts in this topic

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 ?

Share this post


Link to post
Share on other sites

#2 ·  Posted (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 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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

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