Jump to content

Recommended Posts

Posted

Ok guys. I want to make AutoIt click a button in Internet Explorer. I can get the page up ETC, but I can't get it to click the button.

Here are the problems:

-The button changes place

-There is another button next to it

-The button does have text on it

-The button is the same colour as the one next to it

I can't use movemouse because the button changes place

I can't use pixelsearch because there is another button the same colour next to it

Anyone help me?

Here is an example:

#include <IE.au3>

$oIE = _IECreate()
WinSetState ( $oIE, "", @SW_MAXIMIZE )
_IENavigate($oIE, "http://www.google.com")

Say If I wanted the 'Google Search' button pressed. How would I do that if it moved? (Google is an example)

Thank you

Posted

Moving buttons might indicate something else is going on with the page (java, etc), but _IELinkClickByText and/or _IEAction doesn't work? If they don't work, what does the Scite console say when you run them?

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Posted (edited)

Ok guys. I want to make AutoIt click a button in Internet Explorer. I can get the page up ETC, but I can't get it to click the button.

Here are the problems:

-The button changes place

-There is another button next to it

-The button does have text on it

-The button is the same colour as the one next to it

I can't use movemouse because the button changes place

I can't use pixelsearch because there is another button the same colour next to it

Anyone help me?

Here is an example:

#include <IE.au3>

$oIE = _IECreate()
WinSetState ( $oIE, "", @SW_MAXIMIZE )
_IENavigate($oIE, "http://www.google.com")

Say If I wanted the 'Google Search' button pressed. How would I do that if it moved? (Google is an example)

Thank you

Test run the various example scripts for the _IE* functions. You want to find the object reference to the button and then _IEAction($oButton, "click")

Demo:

#include <IE.au3>
Global $oIE = _IECreate("http://www.google.com")
$hIE = _IEPropertyGet($oIE, "HWND")
WinSetState($hIE, "", @SW_MAXIMIZE)
$oForm = _IEFormGetObjByName($oIE, "f")
$oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, "AutoIt")
$oGoogleSearch = _IEFormElementGetObjByName($oForm, "btnG")
_IEAction($oGoogleSearch, "click")

Note that I knew the names of these objects to write the script with. I found them using the DebugBar plug in for IE.

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Posted (edited)

Moving buttons might indicate something else is going on with the page (java, etc), but _IELinkClickByText and/or _IEAction doesn't work? If they don't work, what does the Scite console say when you run them?

How would I go about _IEAction working? How can I get it to click a button? (Remember, its a button, not a hyperlink)

EDIT.

Ok, I understand now. So how do I found out the objects reference?

Edited by mattygibbard
Posted

The tool Psalty used called Debugbar is very good. The link can be found in DaleHohm's sig (Dale is the one who wrote the IE* functions)

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

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
  • Recently Browsing   0 members

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