jeroen96 Posted February 18, 2015 Posted February 18, 2015 (edited) hello, I am new to autoit and i want to search for a certain sentence in the html of a website. the sentence is: <span id="wood" title="Hout - 45 per uur" class="res">849</span> but when i use Global $tekst = _IEBodyReadHTML ($oIE) If StringInStr ($tekst,"<span id={Asc 34}wood{asc 34} title={asc 34}Hout - 45 per uur{asc 34} class = {asc 34}res{asc 34}>849</span") Then MsgBox (0,"Found!","The text was found!",3) Else MsgBox (0,"Failed!","The text was not found!",3) EndIf it does not find the string. I tried some things and i think it has something to do with the {asc 34} I hope someone can help me! Edited February 18, 2015 by SmOke_N put code in code block
MikahS Posted February 18, 2015 Posted February 18, 2015 (edited) try this: StringInStr($tekst, '<span id="wood" title="Hout - 45 per uur" class="res">849</span') EDIT: Also, welcome to the AutoIt forum. Using code tags will greatly help us look at a problem quickly, like so: [ autoit ] ; code here [ /autoit ] (remove spaces) Local $var = "test" ; test Edited February 18, 2015 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
jeroen96 Posted February 18, 2015 Author Posted February 18, 2015 thank you! i did not know it was that simple haha i also have another question, the 849 is variable on the internet, how can i use that variable in my script?
jdelaney Posted February 18, 2015 Posted February 18, 2015 #include <IE.au3> $oIE = _IECreate("yoururl.com") $oObj = _IEGetObjById($oIE,"wood") $text = $oObj.innertext ConsoleWrite($text & @CRLF) IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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