Hello,
please can anyone help me? I work on stats mod for game SWAT 4. What I need is get "Score" value from webpage.
URL is: https://swat4stats.com/player/2018/Spid ... 4855/coop/ - scroll down and you can see player score: 436 (today, it will be change when player will be play)
I start with:
UrlDownloadToFile, https://swat4stats.com/player/2018/Spid ... 4855/coop/, example.txt
and from here I need export only number of score (436) to msgbox.
Did anyone know how?
Thank you
GET value from Webpage to msgbox
Re: GET value from Webpage to msgbox
jeeswg's Internet Explorer and HTML tutorial
Code: Select all
pwb := ComObjCreate("InternetExplorer.Application") ;create IE Object
pwb.visible:=false ; Set the IE object to visible
pwb.Navigate("https://swat4stats.com/player/2018/SpiderMan/54855/coop/") ;Navigate to URL
while pwb.busy or pwb.ReadyState != 4 ;Wait for page to load
Sleep, 100
;use iWB2 Learner to find element class name & index
MsgBox % pwb.document.getElementsByClassname("right")[1].innerText
live ? long & prosper : regards
-
- Posts: 4335
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: GET value from Webpage to msgbox
You don't need to use InternetExplorer.Application for this purpose, it's too slow and resource intensive. You could use WinHttpRequest like this:
Code: Select all
oWhr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
oWhr.Open("GET", "https://swat4stats.com/player/2018/SpiderMan/54855/coop/", false)
oWhr.Send()
status := oWhr.status
if !(status = 200 || status = 304) {
MsgBox, Can't get info from https://swat4stats.com`nStatus: %status%
Return
}
html := oWhr.responseText
RegExMatch(html, ">Score<.*?\K\d+", score)
MsgBox, % score
Re: GET value from Webpage to msgbox
Thank you, it works perfectly.
But only one small problem. In other player ex. https://swat4stats.com/player/2018/____ ... 9140/coop/ his score is 137,610. Msgbox write only 137.
But only one small problem. In other player ex. https://swat4stats.com/player/2018/____ ... 9140/coop/ his score is 137,610. Msgbox write only 137.
-
- Posts: 4335
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: GET value from Webpage to msgbox
We can change RegExMatch to read both:
Code: Select all
RegExMatch(html, ">Score<.*?\K\d+(,\d+)?", score)
Who is online
Users browsing this forum: KolaBorat and 83 guests