Jump to content
Sign in to follow this  
Bert

StringInStr sometimes fails

Recommended Posts

Bert

I have a script that doesn't work the same way everytime. I'm doing this:

$pagechk1 = _IEDocReadHTML($oIE)

$sIs1 = StringInStr($pagechk1,">Log In</A>")

The HTML string I'm reading (excerpt)

<BR> &nbsp; <FONT COLOR=red> &nbsp; You must be logged in to use the MyDocuments agent.</FONT><br>
<BR> &nbsp; Click here to log in: <A HREF="/xxxxxxxxxx.nsf/Report?OpenForm&mydocuments&login">Log In</A><HR>

I'm having it read the same page everytime. Most of the time $sIs1 reports a location of ">Log In</A>" . Sometimes it says it can't find the string and reports "0". I can have it read $pagechk1 again, and then it finds it like it should. I'm wondering if the space in the search string is messing it up. Can anyone reproduce it with the data I'm providing?

Share this post


Link to post
Share on other sites
weaponx

Did you try putting some error control after $pagechk1 = _IEDocReadHTML($oIE)??

Like StringLen() or check for @ERROR???

Share this post


Link to post
Share on other sites
Jos

...having fun with Domino http. :D

The data you provided is when it fails or is that how it looks when it works ?

Would be interested to see the content of $pagechk1 when it fails.


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
weaponx

Why not just :

$sIs1 = StringInStr($pagechk1,"Log In")

-or-

$sIs1 = StringRegExp($pagechk1,"Log In",0)

Share this post


Link to post
Share on other sites
Bert

...having fun with Domino http. :D

The data you provided is when it fails or is that how it looks when it works ?

Would be interested to see the content of $pagechk1 when it fails.

Good question. I put a msgbox with the $pagechk1 in it to see what was there when it failed. I could see the thing I needed to find, so I'm confused as to why it did not find it.

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  

×