Solved batch extracting certain characters from text file

June 10, 2017 at 09:48:34
Specs: Windows 7
I am interested to but I can't figure out how to extract specific characters from txt file.


---------- INDEX.LOG
[380] <span class="text-large" id="quote_price">$0.269323</span> <span class="text-large negative_change">(-7.55%)</span>

I want to extract "0.269323" but I can't figure out how to do it. I tryed few things but I think that those <> mess some things.

message edited by Emerpox


See More: batch extracting certain characters from text file

Reply ↓  Report •

✔ Best Answer
June 10, 2017 at 14:02:07
Yeah, it's easier to just have Internet Explorer get the page, 'cause then you can query the DOM directly.
With CreateObject("InternetExplorer.Application")
  Do While .Busy
    WScript.Sleep 200
  Loop
  .Navigate "https://coinmarketcap.com/currencies/ripple/"
  Do While .Busy
    WScript.Sleep 200
  Loop
  quote = .Document.GetElementById("quote_price").innerText
  quote = Replace(quote, "$", "")
  WScript.Echo quote
  .Quit
End With

How To Ask Questions The Smart Way

message edited by Razor2.3



#1
June 10, 2017 at 10:08:40
Are you pulling this from some website, or something? 'Cause if so, pulling it from the website and getting the value would be like two lines of PowerShell.

How To Ask Questions The Smart Way


Reply ↓  Report •

#2
June 10, 2017 at 10:13:19
Yes I am pulling it with vbs and then extracting this 1 line but I don't know how to get just the number.

Reply ↓  Report •

#3
June 10, 2017 at 11:34:59
Show the VBScript. I'll see if it can't be easily modified to extract the number.

How To Ask Questions The Smart Way


Reply ↓  Report •

Related Solutions

#4
June 10, 2017 at 12:21:37
dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", "https://coinmarketcap.com/currencies/ripple/", False
xHttp.Send

with bStrm
.type = 1 '//binary
.open
.write xHttp.responseBody
.savetofile "c:\Users\Luka\Crypto\index.log", 2 '//overwrite
end with


Reply ↓  Report •

#5
June 10, 2017 at 14:02:07
✔ Best Answer
Yeah, it's easier to just have Internet Explorer get the page, 'cause then you can query the DOM directly.
With CreateObject("InternetExplorer.Application")
  Do While .Busy
    WScript.Sleep 200
  Loop
  .Navigate "https://coinmarketcap.com/currencies/ripple/"
  Do While .Busy
    WScript.Sleep 200
  Loop
  quote = .Document.GetElementById("quote_price").innerText
  quote = Replace(quote, "$", "")
  WScript.Echo quote
  .Quit
End With

How To Ask Questions The Smart Way

message edited by Razor2.3


Reply ↓  Report •

Ask Question