laffo16 Posted November 1, 2006 Share Posted November 1, 2006 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 Link to comment Share on other sites More sharing options...
Valuater Posted November 1, 2006 Share Posted November 1, 2006 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,'Record:' & $x, $aRecords[$x]) Next 8) Link to comment Share on other sites More sharing options...
Snarg Posted November 1, 2006 Share Posted November 1, 2006 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. Link to comment Share on other sites More sharing options...
laffo16 Posted November 1, 2006 Author Share Posted November 1, 2006 thanks for help, Link to comment Share on other sites More sharing options...
Valuater Posted November 1, 2006 Share Posted November 1, 2006 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) Link to comment Share on other sites More sharing options...
Snarg Posted November 1, 2006 Share Posted November 1, 2006 Do what Valuater said, he is way smarter then me. A little reading goes a long way. Post count means nothing. Link to comment Share on other sites More sharing options...
laffo16 Posted November 1, 2006 Author Share Posted November 1, 2006 thnks valuater, i'll try your code when i get a minute, looks v nice. i just butchered together somethin scrappy for now , $currenttime = (@HOUR * 60) + @MIN $racetime = ((StringLeft($line[$i], 2) * 60) + StringLeft(StringTrimLeft($line[$i], 3), 2)) - 5 do you use betangel? Link to comment Share on other sites More sharing options...
Valuater Posted November 1, 2006 Share Posted November 1, 2006 ... do you use betangel?no... just sounds like fun to write the script8) 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