jmstubiera Posted October 21, 2016 Posted October 21, 2016 Hello guys, So I was trying to pull out the information from a web page. I manage to get the whole information on text, what I want to do is to find a string then once the program finds the string, it'll then print out the first 5 letters after that string. Any ideas with this? This is my code so far, I was able to put out the string to check, what I want to do is print out the first five letters after that. Thanks in advance. $webBrowser = _IECreate("http://google.com", 0, 0, 1) Local $sText = _IEBodyReadText($webBrowser) $iPosition = StringInStr("" & $sText & "", "Google.com.ph") $sString = StringMid("" & $sText & "", $iPosition, 13) MsgBox(0, "Test", $sString)
rcmaehl Posted October 21, 2016 Posted October 21, 2016 (edited) Try: $webBrowser = _IECreate("http://google.com", 0, 0, 1) $sText = _IEBodyReadText($webBrowser) $sSearchfor = "google.com.ph" ; Edit this $iLength = StringLen($sSearchfor) ; Don't edit this $iPosition = StringInStr($sText, $sSearchfor) $sString = StringMid("" & $sText & "", $iPosition + $ilength, 5) MsgBox(0, "Test", $sString) Edited October 21, 2016 by rcmaehl jmstubiera 1 My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated. My Projects WhyNotWin11, MSEdgeRedirect Cisco Finesse, Github, IRC UDF, WindowEx UDF
jmstubiera Posted October 21, 2016 Author Posted October 21, 2016 (edited) 22 minutes ago, rcmaehl said: Try: $webBrowser = _IECreate("http://google.com", 0, 0, 1) $sText = _IEBodyReadText($webBrowser) $sSearchfor = "google.com.ph" ; Edit this $iLength = StringLen($sSearchfor) ; Don't edit this $iPosition = StringInStr($sText, $sSearchfor) $sString = StringMid("" & $sText & "", $iPosition + $ilength, 5) MsgBox(0, "Test", $sString) That's it. Thanks, bro. Edited October 21, 2016 by jmstubiera
jmstubiera Posted October 21, 2016 Author Posted October 21, 2016 (edited) Got it now. Thanks, again. Edited October 21, 2016 by jmstubiera
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