Smartgambler
Pro-Punter

Go Back   OZmium Sports Betting and Horse Racing Forums > Public Forums > General Topics
User Name
Password
Register FAQ Search Today's Posts Mark all topics as read

To advertise on these
forums, e-mail us.

Reply
 
Thread Tools Search this Thread Display Modes
  #11  
Old 21st May 2014, 05:12 PM
evajb001 evajb001 is offline
Member
 
Join Date: Oct 2009
Posts: 463
Default

Here's the code to get more then 1 race on the same sheet, should help you figure out how to get all races in a basic sense. Obviously you can build on this so that it works out how many races for that venue etc etc but this should give you a good starting block to get it all working.

Sub LoadRaceField()

Dim xmldoc As MSXML2.DOMDocument

Set xmldoc = New MSXML2.DOMDocument

xmldoc.async = False
xmldoc.Load ("http://tatts.com/pagedata/racing/2014/5/21/SR1.xml")

If (xmldoc.parseError.errorCode <> 0) Then
MsgBox ("An error has occurred: " & xmldoc.parseError.reason)
Else
Set runnerList = xmldoc.selectNodes("//Runner")
Set oddsList = xmldoc.selectNodes("//WinOdds")

Sheet1.Cells.Clear

For i = 0 To (runnerList.Length - 1)

Set Runner = runnerList.Item(i)
Set winodds = oddsList.Item(i)

Set runnerNumber = Runner.Attributes.getNamedItem("RunnerNo")
Set runnerName = Runner.Attributes.getNamedItem("RunnerName")
Set runnerWeight = Runner.Attributes.getNamedItem("Weight")
Set riderName = Runner.Attributes.getNamedItem("Rider")
Set runnerOdds = winodds.Attributes.getNamedItem("Odds")


If Not runnerNumber Is Nothing Then
Sheet1.Cells(i + 1, 1) = runnerNumber.Text
End If

If Not runnerName Is Nothing Then
Sheet1.Cells(i + 1, 2) = runnerName.Text
End If

If Not runnerWeight Is Nothing Then
Sheet1.Cells(i + 1, 3) = runnerWeight.Text
End If

If Not riderName Is Nothing Then
Sheet1.Cells(i + 1, 4) = riderName.Text
End If

If Not runnerOdds Is Nothing Then
Sheet1.Cells(i + 1, 5) = runnerOdds.Text
End If

Next
End If

Race2
End Sub

Sub Race2()

Dim xmldoc As MSXML2.DOMDocument

Set xmldoc = New MSXML2.DOMDocument

xmldoc.async = False
xmldoc.Load ("http://tatts.com/pagedata/racing/2014/5/21/SR2.xml")

If (xmldoc.parseError.errorCode <> 0) Then
MsgBox ("An error has occurred: " & xmldoc.parseError.reason)
Else
Set runnerList = xmldoc.selectNodes("//Runner")
Set oddsList = xmldoc.selectNodes("//WinOdds")

For i = 0 To (runnerList.Length - 1)

Set Runner = runnerList.Item(i)
Set winodds = oddsList.Item(i)

Set runnerNumber = Runner.Attributes.getNamedItem("RunnerNo")
Set runnerName = Runner.Attributes.getNamedItem("RunnerName")
Set runnerWeight = Runner.Attributes.getNamedItem("Weight")
Set riderName = Runner.Attributes.getNamedItem("Rider")
Set runnerOdds = winodds.Attributes.getNamedItem("Odds")


If Not runnerNumber Is Nothing Then
Sheet1.Cells(i + 25, 1) = runnerNumber.Text
End If

If Not runnerName Is Nothing Then
Sheet1.Cells(i + 25, 2) = runnerName.Text
End If

If Not runnerWeight Is Nothing Then
Sheet1.Cells(i + 25, 3) = runnerWeight.Text
End If

If Not riderName Is Nothing Then
Sheet1.Cells(i + 25, 4) = riderName.Text
End If

If Not runnerOdds Is Nothing Then
Sheet1.Cells(i + 25, 5) = runnerOdds.Text
End If

Next
End If

End Sub

EDIT: I noticed it seems to load quicker then doing the web queries too, might have to be something I look at using instead.
Reply With Quote
  #12  
Old 21st May 2014, 05:31 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default

Nake sure you add the "s" to the address https://tatts.com/pagedata/racing/2014/5/21/SR7.xml
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #13  
Old 21st May 2014, 05:33 PM
Rinconpaul Rinconpaul is offline
Banned
 
Join Date: Feb 2013
Posts: 755
Thumbs up

You're destined for higher things Josh, I've always said that! Not only are you brilliant but you're willing to help others when asked. If you ever need a character reference, just ask.

Now from what I can work out, I'll need to amend the script (is that what you call it?) for each raceday date, venue and race number?

Is the result that I see on the page a continually updating one or is it static, as in a picture of the tote odds at the instant I executed the button?

I wanted this so as to load a scatter chart instantly and start cataloging 'star patterns' ???,.......... you know, for the upcoming book! Which by the way, you'll be getting the first signed copy of...

Cheers again.
Reply With Quote
  #14  
Old 21st May 2014, 05:39 PM
evajb001 evajb001 is offline
Member
 
Join Date: Oct 2009
Posts: 463
Default

RCP, it will be like taking a screenshot of whatever is viewable on the website at the time you press the button.

In terms of changing the date, venue and race number that is something you'll have to do within the script (macro) at the moment, however it should be possible to make it so you can put these details into cells within the spreadsheet, hit the button and it will update without actually having to go within the script and risk disrupting anything.

Let me see what I can come up with and i'll post a bit later. In theory it shouldn't be too difficult but computers find a way of never making things that easy.
Reply With Quote
  #15  
Old 21st May 2014, 05:45 PM
Rinconpaul Rinconpaul is offline
Banned
 
Join Date: Feb 2013
Posts: 755
Default

I'll look forward to that improvement. I seem to remember about a year ago you doing something similar?

Anyway here's the first print run below, brilliant.
Attached Images
File Type: jpg Josh for PM.JPG (89.3 KB, 373 views)
Reply With Quote
  #16  
Old 21st May 2014, 06:29 PM
Rinconpaul Rinconpaul is offline
Banned
 
Join Date: Feb 2013
Posts: 755
Thumbs up

I just checked out which horse won SR2, the bottom image on the prev post's jpg. It was that 'faraway star' the longshot Speedy Wally BF $65, the highest priced horse in the race.

As a longshot Layer, I never got caught by that one, in fact no accidents in over 3 weeks, and I have to thank the systems I've built around the Ratings 2 Win data, which had it 'in the Green' for a possibility of an upset win. That just saved me $2k in one bet, the cost of purchasing the Pro package and 3 months subscription. Onya R2W. Still a way to go, to adapt the system for the Layers though....

Does this mean an end to 'star gazing', not likely, there's still money to be made.
Reply With Quote
  #17  
Old 21st May 2014, 06:29 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default

I hard codded a couple cells for the date and the race code

on sheet1 in cell I1 put =Today()
In cell K1 put your race code like SR1

Had to also adjust the clear function so it only clears to row E

Sub LoadRaceField()

Dim xmldoc As MSXML2.DOMDocument

Set xmldoc = New MSXML2.DOMDocument

xmldoc.async = False
xmldoc.Load ("https://tatts.com/pagedata/racing/" & Format(Sheets("Sheet1").Range("I1").Value, "yyyy/m/dd") _
& "/" & Sheets("Sheet1").Range("K1").Value & ".xml")

If (xmldoc.parseError.ErrorCode <> 0) Then
MsgBox ("An error has occurred: " & xmldoc.parseError.reason)
Else
Set runnerList = xmldoc.SelectNodes("//Runner")
Set oddsList = xmldoc.SelectNodes("//WinOdds")

Sheets("sheet1").Range("A1:E50").Select
Selection.ClearContents
Range("A1").Select

For i = 0 To (runnerList.Length - 1)

Set Runner = runnerList.Item(i)
Set winodds = oddsList.Item(i)

Set runnerNumber = Runner.Attributes.getNamedItem("RunnerNo")
Set runnerName = Runner.Attributes.getNamedItem("RunnerName")
Set runnerWeight = Runner.Attributes.getNamedItem("Weight")
Set riderName = Runner.Attributes.getNamedItem("Rider")
Set runnerOdds = winodds.Attributes.getNamedItem("Odds")


If Not runnerNumber Is Nothing Then
Sheet1.Cells(i + 1, 1) = runnerNumber.Text
End If

If Not runnerName Is Nothing Then
Sheet1.Cells(i + 1, 2) = runnerName.Text
End If

If Not runnerWeight Is Nothing Then
Sheet1.Cells(i + 1, 3) = runnerWeight.Text
End If

If Not riderName Is Nothing Then
Sheet1.Cells(i + 1, 4) = riderName.Text
End If

If Not runnerOdds Is Nothing Then
Sheet1.Cells(i + 1, 5) = runnerOdds.Text
End If

Next
End If

End Sub
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #18  
Old 21st May 2014, 06:35 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default

What you could also do is set up a sheet to bring in the meetings first then you could setup a list to choose the races or if data collection is needed it could be designed to run in auto mode.
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #19  
Old 21st May 2014, 06:50 PM
Rinconpaul Rinconpaul is offline
Banned
 
Join Date: Feb 2013
Posts: 755
Thumbs up

Thanks for your input Shaun. I'd like to see the perfect setup posted here for all forumites to access. There's been quite a few posts on the subject in the past, coz I searched. They were all ad hoc, with no final solution revealed. Not as if your giving the 'Grail' away here. More power to all forumites, I say! Heaven knows, we need it.
Reply With Quote
  #20  
Old 21st May 2014, 07:01 PM
evajb001 evajb001 is offline
Member
 
Join Date: Oct 2009
Posts: 463
Default

Here you go RCP, give this a try as attached
Attached Files
File Type: xlsm Starlight_Starbright.xlsm (22.2 KB, 438 views)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



All times are GMT +10. The time now is 10:45 AM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2008 OZmium Pty. Ltd. All rights reserved . ACN 091184655