Sign in to follow this  
Followers 0
laffo16

Time based query. help

8 posts in this topic

hey guys,

trying to figure out how i should go about coding this, i have the following data in a txt file,

14:00-20130640

14:10-20130681

14:20-20130701

14:35-20130642

14:45-20130683

14:55-20130703

15:10-20130644

15:20-20130685

15:30-20130705

15:45-20130646

15:50-20130650

15:55-20130687

16:05-20130707

16:15-20130648

16:20-20130652

16:30-20130689

16:50-20130654

17:20-20130656

17:50-20130658

18:20-20130660

the time is when the horse race begins, and the row of numbers atfer the time is the ID of the race. now i'm building a bot for betangel.com basic which will auto back/lay horses. i need the correct race to be loaded 5 minutes before the race begins. what would be the easiest way of finding if the current time is 5 minutes before $line[$i]. my current snipit is:

$racetxt = FileOpen("race.txt", 0)

Dim $line[51]
Dim $i
For $i = 1 to 50
    $lines = FileReadLine($racetxt)
    $line[$i] = $lines
Next

FileClose($racetxt)

For $i = 1 to 50
    if $line[$i] .....
next

Share this post


Link to post
Share on other sites



i would be interested in see/helping with this

first i would use _FileReadtoArray()

#include <file.au3>

Dim $File_Name = "race.txt"
Dim $aRecords

If Not _FileReadToArray($File_Name,$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

For $x = 1 to $aRecords[0]
    
    ; If - starting here
    
    Msgbox(0,&apos;Record:&apos; & $x, $aRecords[$x])
Next

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Open up date.au3 in your include folder. Using the function below you could do a comparison between two dates. If they are 5 mins or less apart, start doing whatever you need to do. You need the beta for this:

;===============================================================================
;
; Description:      Returns the difference between 2 dates, expressed in the type requested
; Parameter(s):     $sType - returns the difference in:
;                               d = days
;                               m = Months
;                               y = Years
;                               w = Weeks
;                               h = Hours
;                               n = Minutes
;                               s = Seconds
;                   $sStartDate    - Input Start date in the format "YYYY/MM/DD[ HH:MM:SS]"
;                   $sEndDate    - Input End date in the format "YYYY/MM/DD[ HH:MM:SS]"
; Requirement(s):   None
; Return Value(s):  On Success - Difference between the 2 dates
;                   On Failure - 0  and Set
;                                   @ERROR to:  1 - Invalid $sType
;                                               2 - Invalid $sStartDate
;                                               3 - Invalid $sEndDate
; Author(s):        Jos van der Zande
; Note(s):
;
;===============================================================================

A little reading goes a long way. Post count means nothing.

Share this post


Link to post
Share on other sites

thanks for help,

Share this post


Link to post
Share on other sites

thanks for help,

well... now thats ok too

but if you want to make it work great.. here is an idea

#include <file.au3>

Dim $File_Name = "race.txt"
Dim $aRecords, $Race_Time, $Race_Number, $x

If Not _FileReadToArray($File_Name,$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf

$Now_Time = @HOUR & ":" & @MIN
$x = 1
While 1
    GetRace($x)
    MsgBox(64, $Now_Time, $Race_Time & @CRLF & $Race_Number)
    Exit    


WEnd
    
Func GetRace(ByRef $x)
    $Split = StringSplit($aRecords[$x], "-")
    $Race_Time = $Split[1]
    $Race_Number = $Split[2]
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Do what Valuater said, he is way smarter then me.


A little reading goes a long way. Post count means nothing.

Share this post


Link to post
Share on other sites

thnks valuater, i'll try your code when i get a minute, looks v nice.

i just butchered together somethin scrappy for now :whistle:,

$currenttime = (@HOUR * 60) + @MIN
$racetime = ((StringLeft($line[$i], 2) * 60) + StringLeft(StringTrimLeft($line[$i], 3), 2)) - 5

do you use betangel?

Share this post


Link to post
Share on other sites

... do you use betangel?

no

... just sounds like fun to write the script

8)


NEWHeader1.png

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