Jump to content

IELinkClickByText problems


Recommended Posts

Okay. so im basically trying to make a "bot" which clicks a link in internet explorer maybe every hour.

this is how its going so far:

#include <IE.au3>

$oIE = _IECreate()

_IENavigate($oIE, "http://en28.tribalwars.net/staemme.php?screen=overview&top")

_IELoadWait ($oIE)

_IELinkClickByText ($oIE, "Forum")

what this does/is supposed to do is :

1. open internet explorer

2. navigate to the link

3. click on a certain link

thats ALL it has to do.

so number 1 and number 2 is working. but i cant seem to figure out number 3.

ive tested the following in google:

#include <IE.au3>

$oIE = _IECreate()

_IENavigate($oIE, "google.com")

_IELoadWait ($oIE)

_IELinkClickByText ($oIE, "Images")

and this script works perfectly.

so why is it not working with the other script?

what can i do to make it click what i want?

ive searched and ive read lots and lots and ive checked out the help which autoit gives. but im still really confused and i hope someone here can help me.

any comments?

Link to comment
Share on other sites

Why don't you just go directly to the forum instead of clicking text?

the forum is not the actual place i want to go to.

their is another link on the same page i want clicked, but the name and the properties of that link change everytime i click it, etc etc.

anywayz, the point im trying to get at: is that its not letting me click the link on the page using autoit.

I could choose ANY of the links on the page but none of them are working.

so how could i work make this work?

More info below

what i really want to do after i figure the answer:

i want it to click a link that says "upgrade to lvl 7" or something similar. the page then refreshes and it starts upgrading the selected part. usually taking around 40 minutes. after 40 minutes are up, i want it to click "upgrade to lvl 8"....and so on and so on.

It a browser game and is not hackable by things such as cheat engine or anything. so all i want is a bot to click on the link for me so my stuff can upgrade. YOU CANNOT JUST TELL IT TO NAVIGATE TO A LINK FOR IT TO START UPGRADING. so u need the computer to click certain text.

the problem :

i can make the computer click on a link in a different website, such as google. so why is it not working in this particular website?

Edited by bob122
Link to comment
Share on other sites

How you tried it looping through the links?

#include <IE.au3>
$oIE = _IECreate("http://www.autoitscript.com")

$sMyString = "wallpaper"
$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    $sLinkText = _IEPropertyGet($oLink, "innerText")
    If StringInStr($sLinkText, $sMyString) Then
        _IEAction($oLink, "click")
        ExitLoop
    EndIf
Next

If that still doesn't work, is it a URL you could share with us so we can attempt to try?

Edit: A lot of browser games I've ran into do not work with most of the _IE functions. I ended up just using pixel detection and automated mouse clicks. It's not very pretty, but worked as a temporary script for what I needed them for.

Edit: Signed up for the site myself, still no luck =(

Edited by foster74
Link to comment
Share on other sites

ive got a picture of da gaming website here.

i highlighted the forum part because in my point of view.....if i could get the autoit script to click on the "forum" part, then i can make it click on the part that i actually want to click it on. and its not a link such as the "forum" link which can be navigated to using a address in the address bar.

so if u could figure out how to just click on the "forum" part, then i would be happy.

link of pics below:

http://s24.photobucket.com/albums/c37/loo1...current=lol.jpg

http://i24.photobucket.com/albums/c37/loo123456/aaa.jpg

yeah, i know at least how to do those mouse clicks. but i hate finding coords since my computer is MUCH slower than the average person. so i end up having to guess them, then use trial/error to find the right spot. the problem is, when i click on a certain link, the position may change....and since i dont know what position it will change into, its basically impossible for me to do the mouse click coordinate way. another thing i hate about that way is the fact that, if it screws up while ur away from da computer then the whole thing screws up.

so thats why ive tried it using this way, with the _IEfunctions. so if i cant find a solution i guess its pixel detection clicks, and that will REALLY suck :/

Edited by bob122
Link to comment
Share on other sites

I was bored and this is what I came up with... it runs like the old D2 bot I made, finds a color and clicks on it.. I'm sure one of the pros here could help better but I figured I would post this for you :P

HotKeySet ( "{END}", "exiter")
FUNC exiter()
Exit
ENDFUNC

Opt("WinTitleMatchMode", 2) 
$wName = "Avant";name of your internet explorer window
$URL = "http://www.autoitscript.com/autoit3/";URL to try to find the link on
$step = 10; This changes the step size in the pixel search, starts at 10 and gets smaller
$hColor = "0x316AC5"; color of the background of the text when highlighted

WinActivate($wName)
WinWaitActive($wName)
$coords = WinGetPos ($wName)

Sleep(500)
Send("!d");hotkeys to edit the URL
Sleep(500)
Send($URL)
Sleep(500)
send("{ENTER}")
Sleep(5000)

Send("^f");hotkeys to search the page
Sleep(500)
send("forum")
Sleep(500)
send("{ENTER}")
Sleep(500)
Send("{ESC}"); I just use this to get rid of the search box in IE, you can get rid of this is your's doesn't have a pop up

IF $coords <> 0 THEN
    Do
        $coord = PixelSearch( $coords[0], $coords[1], $coords[2], $coords[3], $hColor, 0, 5 )
        IF Not @error Then
            $step = 0
        ELSE
            $step = $step-1
        EndIf
    Until $step = 0
Else
    Exit
ENDIF

If $coord <> 0 Then
    MouseClick ( "left", $coord[0], $coord[1])
    MsgBox(4096, "SUCCESS", "This script is a win", 10)
Else
    MsgBox(4096, "FAILURE", "This script is a fail", 10)
EndIf
Link to comment
Share on other sites

Works perfectly for the "forum" part. thanx ALOT.

il try it later with the part which i want it to actually click.

question:

if the part i want it to click is "hello 7"

it clicks it, the browser refreshes basically. then i want the script to sleep for say 30minutes.

then to search and click "hello 8".

easy and possible im guessing?

THANX ALOT

uve helped me and made me happy, lol :P

Edited by bob122
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...