Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 16:51

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



_StringBetween help

Discussion on _StringBetween help within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2014
Posts: 132
Received Thanks: 31
_StringBetween help

Hi guys
I want to get "45.000"
HTML Code:
    <div id="header_credits" class="header_money">
        45.000
    </div>
from here :/ but stringbetween doesnt work on it
lenclstr746 is offline  
Old 04/13/2018, 14:17   #2
 
elite*gold: 0
Join Date: Feb 2014
Posts: 132
Received Thanks: 31
anyone help ???
lenclstr746 is offline  
Old 04/13/2018, 19:41   #3
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
You have two ways of doing it, with dom elements using IE or with regexp, depends on what u want to do:
Code:
Func example1()
$html = '<div id="header_credits" class="header_money">45.000</div>'

$pattern = "(?m)(?s)<div.*>(.*?)</div>"

Local $reg = StringRegExp($html,$pattern,1)

;remove white space and CR from string
$result = StringStripWS($reg[0],8)
$result = StringReplace($result,@CRLF,"")
MsgBox(0,"",$result)
EndFunc

example1()

#include <IE.au3>
#include <Array.au3>

example2()


Func example2()
$oIE = _IECreate("https://www.cnbc.com/dow-components/")
_IELoadWait($oIE)


$table = $oIE.document.getElementsByTagName("tbody").item(0)

$rows = $table.getElementsByTagName("tr")
;name | price
Local $arr[$rows.length][2]

for $i =0 to $rows.length-1
$col = $rows.item($i).getElementsByTagName("td")
   for $c = 0 to $col.length -1
	  $att = $col.item($c).getAttribute("data-field")
	  if $att == "name" Then
		 $arr[$i][0] = $col.item($c).innerText
	  EndIf
	  if $att == "last" Then
		 $arr[$i][1] = $col.item($c).innerText
	  EndIf
   Next
Next

_ArrayDisplay($arr,"example","",0,Default,"NAME | PRICE")
EndFunc
elmarcia is offline  
Old 04/13/2018, 22:01   #4

 
Moneypulation's Avatar
 
elite*gold: 138
Join Date: Apr 2012
Posts: 3,494
Received Thanks: 1,769
You can get the number from that html code using stringbetween without a problem. Show us your code and we can try to figure out the problem
Moneypulation is offline  
Reply


Similar Threads Similar Threads
Problem mit _stringbetween
02/25/2014 - AutoIt - 2 Replies
Hallo erstmal, Ich habe ein kleines Problem mit _stringbetween. In meinem Fall suche ich Spielernamen im Quelltext die eine gewisse Stufe erreicht haben und dann wird mein Hauptprogramm ausgeführt. Wenn man durch _stringbetwen aber mehrerer Ergebnisse findet, wie können die Ergebnisse einzelnd abgearbeitet werden. Und falls im erneuten Suchlauf wieder einer der schon bereits abgearbeiten Spielernamen auftaucht, sollten diese übersprungen werden. Kann mir da jemand ein kleines Beispiel oder...
Fehlersuche?? Brauch Hilfe bei _Stringbetween
05/01/2012 - AutoIt - 2 Replies
Hallo, ich hab letztens viel probiert und ich weis jetzt genau wie ich ein loggin bot mache nur eine Funktion will nicht funktionieren hier ein teil von mein skript #include <WinHttp.au3> #include <String.au3> #include <Array.au3> $input1 = inputbox ("Username","Username:") $input2 = inputbox ("Password","Password:") $input3 = inputbox ("Server","Server:") $hSession = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0")...
_stringbetween im quelltext mit absatz
10/24/2011 - AutoIt - 2 Replies
Hi, wie kann ich eine Quelltextstelle mit _stringbetween auslesen wo drin ein Absatz ist? <input type="submit" name="Submit" class="button" value="Anmelden" /> <input type="hidden" name="option" value="com_users" /> <input type="hidden" name="task" value="user.login" /> <input type="hidden" name="return" value="sdaxxxxxxxxxsladkö2=" /> <input type="hidden" name="mdlöas2839120dskj2830" value="1" />
[Frage]_StringBetween und _INetGetSource
04/24/2011 - AutoIt - 7 Replies
Hey E*pvp, hab ein Problem. Er soll die Seite auslesen und es in ner Msgbox wieder geben, aber er gibt immer nix aus! $read= _StringBetween(_INetGetSource("http://my-test app.co.de/log.html"),'
autoit3 problem (_stringbetween)
02/24/2011 - AutoIt - 3 Replies
Hi all ... ich bin neu hier und habe mit autoit angefangen. Ich habe mit mehrere Tutorials durchgelesen und wollte jetzt was eigenes schreiben... (Ogamebot nach anleitung http://www.elitepvpers.com/forum/epvp-coders-tutor ials/457030-autoit-tutorial-zu-browsergamebots-pac ketbots-und-iebots.html) ...bin bisher jedoch nicht sehr weit gekommen, da ich Probleme beim auslesen des quelltextes habe Wenn ich den Code so schreibe hat der Array bei der Asusgabe keinen Wert Dim $session



All times are GMT +1. The time now is 16:51.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.