AutoIT getElementBy...

08/09/2016 01:00 Dequalityy#1
Can anyone help me out here?
i'm trying to make a bot thats just clicks the buttons without using mouse u know getting the "API"? i guess it's called totally new to this only made some pixel bots :-D but im trying to find this button

<a href="http://s21.en.bitefight.gameforge.com/robbery/index" target="_top">Hunt</a>

How would i do that any example would be deeply appreciatet! :)

Tried some different stuff tried like this


Code:
	$btnHunt = .document.getElementsByTagName("Example")

	for $b in $btnHunt
		if $b.innerHTML = "Hunt" Then
			$b.click()
		EndIf
	Next
Code:
$ie = ObjCreate("InternetExplorer.Applicaion") <- Found the fail missed a T .. lol 
#include <IE.au3>

With $ie

		.visible = True
		.navigate("http://s21.en.bitefight.gameforge.com/")

	While($ie.busy)
	WEnd

		$getHunt = _IE_Example("button")
		$hunt = _IEGetObjByName($getHunt,"Hunt")
		_IEAction($hunt, "click")

EndWith
Tried the code above, it wont even create / open Internet explorer =(

Tried another way too,

Element i need to click.

I've also found it as a image but how do i make it click a image? (the image works as a link but doesnt show a link in the code. :/ )
08/10/2016 03:35 elmarcia#2
if u want to click a button that call a defined function in js, it's more simple to inject javascript with your browser developer console (i prefer Chrome)

Make sure that u have selected top in Chrome's console or the script won't work

[Only registered and activated users can see links. Click Here To Register...]
Code:
function doSth(){
//Bot logic here
doHunt(1) //this will call the function that Farm button does when is clicked.
}

var myInterval
start()//Starts the bot, to stop the bot print stop() in javascript console and hit enter...

function start(){
myInterval = setInterval(doSth(),100)
}

function stop(){
clearInterval(myInterval)
}