Sign in to follow this  
Followers 0
Uniquelol3r

Downloader Script according to certain times.

6 posts in this topic

#1 ·  Posted (edited)

Hello, basically I have a deal in my internet package where from 2:00am to 8:00am, I have unlimited download bandwidth . However I don't think I will be awake at that time to Download. Basically, this is the script that I thought would work, however its not working properly, firstly it doesn't loop and if there it is not 2:00am it just stops.

What the script should do:

1. Run twenty-four seven.

2. If it is 2:00 am it should start the Download. 

3. If it is 8:00 am it should stop the Download.

#include <Date.au3>  
$StartTime1 = "02:00"
$EndTime1 = "08:00"
$CurrentTime = _NowTime(4);
$ImpossibleTime = "25:00"
AdlibRegister("_Check",1000*60)

While 1
Sleep(1000)
WEnd

Func _Check()
   If($CurrentTime >= $EndTime1) Then
      Sleep(3000)
      MsgBox(0, "Computer", "It is time to start the Download, 1)
      MouseClick("right", 252, 371, 1)
      Sleep(10000)
      MouseClick("left", 351, 410, 1)
   ElseIf
      Sleep(3000)
      MsgBox(0,"Computer","It is time to Shut Down the Download", 1)
      MouseClick("right", 252, 371, 1)
      Sleep(10000)
      MouseClick("left", 311, 449, 1)
   EndIf
AdlibUnRegister();
Exit
EndFunc
Edited by Uniquelol3r

Share this post


Link to post
Share on other sites



You never update the value in  $CurrentTime, you set it once when the script starts, and never update it again. Also, you don't do any check to see whether the time is between your start and end times, you're only checking to see if the current time is after the end time. You need to update the current time value inside the function, and you need to check to see if the current time is in between your start and end times, and then you need to check to see if the download has already been started if it is, and don't attempt to start it again.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I understand, mhmm thats pretty interesting can you tell me how will I be able to accomplish that? My programming is pretty bad.. ;(

Share this post


Link to post
Share on other sites

Here's one way of doing it, there are many other ways of acheiving this, but this one is probably the easiest to understand.

#include <MsgBoxConstants.au3>
Global $bAlreadyStarted = False
$StartTime1 = "0200"
$EndTime1 = "0800"
AdlibRegister("_Check", 10000)

While 1
    Sleep(10)
WEnd

Func _Check()
    $CurrentTime = @HOUR & @MIN
    If $CurrentTime <= $EndTime1 And $CurrentTime >= $StartTime1 Then
;~       Sleep(3000)
        If Not $bAlreadyStarted Then ; Check to see if it's already downloading
            MsgBox($MB_SYSTEMMODAL, "Computer", "It is time to start the Download", 1)
            $bAlreadyStarted = True
            MsgBox($MB_SYSTEMMODAL, "Started", "The download is starting")
            MouseClick("right", 252, 371, 1)
            Sleep(10000)
            MouseClick("left", 351, 410, 1)
        EndIf
    Else
                Sleep(3000)
        MsgBox(0, "Computer", "It is time to Shut Down the Download", 1)
                MouseClick("right", 252, 371, 1)
                Sleep(10000)
                MouseClick("left", 311, 449, 1)
        AdlibUnRegister();
        Exit
    EndIf
EndFunc   ;==>_Check

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thanks I checked the script however for some reason, it again does the mouse click and the script stops.. furthermore I send you a message on adding, the script how it can recognize by looking at the window weather the download is not working or not. 

Share this post


Link to post
Share on other sites

If you have the title of the download window, you can try to have the script see the window by using WinExists, the WinExists tells you it's there, you can have your script skip trying to start it.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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