Sign in to follow this  
Followers 0
David422

Technical Question about an If, Then statement

3 posts in this topic

I would like for my script to run normally until it hits the page, www.gameofficials.net, at which time I would like it to click a link by text and then return to its normal operaton. I'm working with the _IELinkClickByText template, but I don't understand some of the variables like what to put for $sMyString and how i designate the If statement so it will only run this section if it ends up at the www.gameofficials.net URL. Can anyone help me?

this is the _IELinkClickByText template

#include <IE.au3>

$oIE = _IECreate("http://www.autoitscript.com")

$sMyString = "wallpaper"

$oLinks = _IELinkGetCollection($oIE)

For $oLink in $oLinks

$sLinkText = _IEPropertyGet($oLink, "David Mceachin")

If StringInStr($sLinkText, $sMyString) Then

_IEAction($oLink, "click")

ExitLoop

EndIf

Next

Share this post


Link to post
Share on other sites



Maybe this help you understand...

#include <IE.au3>
$oIE = _IE_Example ("basic")
$oLinks = _IELinkGetCollection ($oIE); Grabs all the links on the page.
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")

For $oLink In $oLinks ; Cycles through every link it found
    
    MsgBox(0, "Link Info", $oLink.href & "|  " &  _IEPropertyGet($oLink, "innertext")) ; The URL and the label name
    If StringInStr(_IEPropertyGet($oLink, "innertext"), "User Forum") Then ; If it has "user forum" it's going to click the link
        _IEAction($oLink, "click") ; Click
        ExitLoop ; Exits the 'For' loop
    EndIf
    
Next

Share this post


Link to post
Share on other sites

Maybe this help you understand...

#include <IE.au3>
$oIE = _IE_Example ("basic")
$oLinks = _IELinkGetCollection ($oIE); Grabs all the links on the page.
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")

For $oLink In $oLinks ; Cycles through every link it found
    
    MsgBox(0, "Link Info", $oLink.href & "|  " &  _IEPropertyGet($oLink, "innertext")) ; The URL and the label name
    If StringInStr(_IEPropertyGet($oLink, "innertext"), "User Forum") Then ; If it has "user forum" it's going to click the link
        _IEAction($oLink, "click") ; Click
        ExitLoop ; Exits the 'For' loop
    EndIf
    
Next

This helps, but I still don't know how to get it to do this if and only if it reaches www.gameofficials.net, and where to put the parameters of the text link that I want it to search for ("David McEachin"). I basically only want it to search for and click this text if it reaches this site, and afterwards I would like it to continue operation as normal. Is there anyone with experience with this who can guide me or fill in the values to my template?

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