Jump to content

trap the click of an object in a webbrowser


rot
 Share

Recommended Posts

Hi all,

I hope you will be able to help me.

I want to trap a particular object click in Firefox that will fire a short script.

I was firstly wondering if I can use the _IE... collection for use in Firefox.

Then I wanted to know if a function exists that can trap object clicks other than _ispressed.

If only the function _ispressed can be used, I will need to compare the coordinates of the mouse when clicking with the ones of the object.

But how can I find the coordinates of an object?

Many thanks for your answer.

rv

Link to comment
Share on other sites

For IE, see IEPropertyGet in helpfile ! Posted Image

example :

$iBrowserX = _IEPropertyGet($oElement, "browserx")
    $iBrowserY = _IEPropertyGet($oElement, "browsery")
    $iWidth = _IEPropertyGet($oElement, "width")
    $iHeight = _IEPropertyGet($oElement, "height")
    ControlClick(_IEPropertyGet($IE, "hwnd"), "", "", "left", 1, $iBrowserX + $iWidth/2, $iBrowserY + $iHeight/2)

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

thanks for your answer wakillon ...

I was already looking at the IEPropertyGet function but got lost in the different properties to use to trace the outline. your answer helps a lot.

any idea if an event driven function exists saying the object has been clicked?

thx

Link to comment
Share on other sites

thanks for your answer wakillon ...

I was already looking at the IEPropertyGet function but got lost in the different properties to use to trace the outline. your answer helps a lot.

any idea if an event driven function exists saying the object has been clicked?

thx

See helpfile for _IEHeadInsertEventScript function ! Posted Image

; *******************************************************
; Example 1 - Open a browser with the basic example page, insert an
;               event script into the head of the document that creates
;               a Javascript alert when someone clicks on the document
; *******************************************************
;
#include <IE.au3>
$oIE = _IE_Example ("basic")
_IEHeadInsertEventScript ($oIE, "document", "onclick", "alert('Someone clicked the document!');")

Edit : the 6th example is more interesting

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

thanks a lot wakillon

this function looks more interesting ... unfortunatly I don't have the 6th sample on my version of autoit, but don't worry I'll find it and come back to you if I succeed ... or if I have another question ... who knows? ;)

:)

Link to comment
Share on other sites

thanks a lot wakillon

this function looks more interesting ... unfortunatly I don't have the 6th sample on my version of autoit, but don't worry I'll find it and come back to you if I succeed ... or if I have another question ... who knows? ;)

:)

Sorry it's not the 6, but the 5 th example ! Posted Image

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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...