Sign in to follow this  
Followers 0
iTechTed89

StringInStr() Help...

3 posts in this topic

Overview- Im building a websurfing program that surfs webpages from a list. I Want it to be able to tell which Url is currently surfed and do a If statement if a match is found within the URL.

#include <IE.au3>
Local $aURLs, $oIE, $twit, $test
start()
Func start()
$twit = "twitter.com"
Dim $aURLs
_FileReadToArray("sites.txt", $aURLs)
$ieObj = _IECreate($aURLs[1])
For $i = 2 To $aURLs[0]
  $test = _IEPropertyGet($ieObj, "locationurl")
  MsgBox(0, "test", $test)
  If StringInStr("twitter.com", $test) Then
   MsgBox(0, "twitter", "Twitter is Current Page")
  EndIf
  ;MsgBox(0, "next", "next")
  _IENavigate($ieObj, $aURLs[$i])
Next
MsgBox(0, "done", "done")
EndFunc   ;==>start

I have a txt file "sites.txt" with 1 url per line. If twitter is one of the sites i want it to do the if statement but i cant get it working correctly . Im getting the Url from

$test = _IEPropertyGet($ieObj, "locationurl")
  MsgBox(0, "test", $test)
to display but

StringInStr("twitter.com", $test) isnt doing its job....

Share this post


Link to post
Share on other sites



Overview- Im building a websurfing program that surfs webpages from a list. I Want it to be able to tell which Url is currently surfed and do a If statement if a match is found within the URL.

#include <IE.au3>
Local $aURLs, $oIE, $twit, $test
start()
Func start()
$twit = "twitter.com"
Dim $aURLs
_FileReadToArray("sites.txt", $aURLs)
$ieObj = _IECreate($aURLs[1])
For $i = 2 To $aURLs[0]
  $test = _IEPropertyGet($ieObj, "locationurl")
  MsgBox(0, "test", $test)
  If StringInStr("twitter.com", $test) Then
   MsgBox(0, "twitter", "Twitter is Current Page")
  EndIf
  ;MsgBox(0, "next", "next")
  _IENavigate($ieObj, $aURLs[$i])
Next
MsgBox(0, "done", "done")
EndFunc   ;==>start

I have a txt file "sites.txt" with 1 url per line. If twitter is one of the sites i want it to do the if statement but i cant get it working correctly . Im getting the Url from

$test = _IEPropertyGet($ieObj, "locationurl")
  MsgBox(0, "test", $test)
to display but

StringInStr("twitter.com", $test) isnt doing its job....

StringInStr($test,"twitter.com")

I thing this works like this but i am not really sure if its gonna work for you. I am not really understanding the stript. Provide more infos or the txt file to try it


I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

LOL Thx ... i guess my dyslexia is showing today sorry for the dumb question but your solution worked.

I had it backwords...

StringInStr($test,"twitter.com")

fixed 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  
Followers 0