Jump to content
Sign in to follow this  
rot

trap the click of an object in a webbrowser

Recommended Posts

rot

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

Share this post


Link to post
Share on other sites
wakillon

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

Share this post


Link to post
Share on other sites
rot

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

Share this post


Link to post
Share on other sites
wakillon

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

Share this post


Link to post
Share on other sites
rot

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? ;)

:)

Share this post


Link to post
Share on other sites
wakillon

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

Share this post


Link to post
Share on other sites
rot

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

No problem, I've been working on other issues this afternoon ...

;)

Share this post


Link to post
Share on other sites
wakillon

No problem, I've been working on other issues this afternoon ...

;)

which issues ? Posted Image


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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.