Internet Explorer get element under cursor (show borders, show text) (any zoom percentage)

Post your working scripts, libraries and tools
User avatar
jeeswg
Posts: 4128
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Internet Explorer get element under cursor (show borders, show text) (any zoom percentage)

12 Nov 2017, 10:16

- I've tried creating my own examples of frames within frames e.g. via examples here:
How to Use Frames Tags in HTML »
https://html.com/frames/
However, they look like frames within frames, but I'm not sure that they are actually frames within frames cf. your website.
- If you can give me a link to your website, or send me a saved htm file, or an edited htm file to remove any personal data, or start with the html there and simplify it to create something with the same structure, then I can fix the script.
- If I can get a good html example, then I can fix the script. I'm quite willing to work on this. Until then, I've done as much as I can do.
- I've investigated the maths more fully, so the situation is clearer.
- Some points to mention are frames v. iframes, frames v. framesets, and to check which your website is.
- Did you manage to fix the script yourself? Cheers.
TheDewd
Posts: 849
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Internet Explorer get element under cursor (show borders, show text) (any zoom percentage)

13 Nov 2017, 08:45

jeeswg wrote:Well if there are more levels, you should remove the line 'break'. But I don't know if it will work correctly. If you provide some html examples that have frames within frames, I could experiment. I might try and create such an example myself, so that ultimately my script can handle frames within frames.


Jeeswg: I created an example for you this morning. Please download the HTML files at the following link
https://drive.google.com/open?id=1KxEhW8f0zlfuV_gm0VPHcUWUU954NYJl

Your suggestion to remove the Break did work! Would there be any negative side-effects from removing it? Performance-wise, etc?
User avatar
jeeswg
Posts: 4128
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Internet Explorer get element under cursor (show borders, show text) (any zoom percentage)

13 Nov 2017, 08:56

The break was something I accidentally left in while testing, to prevent an infinite loop, or something like that. I will check the example, thanks.
TheDewd
Posts: 849
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Internet Explorer get element under cursor (show borders, show text) (any zoom percentage)

13 Nov 2017, 13:27

I thought it was behaving correctly when I tested it yesterday, however I now see an issue.

The coordinates are being offset by the size of surrounding frames.

For example, the height of the top frame is offsetting the coordinates in the bottom frame by the exact height of the top frame.

Resizing the top frame to make it shorter is directly affecting the placement of JEE_Borders() in the bottom frame.

Otherwise, removing the Break did work, but I'm not sure how to ignore the size of the other frames. Need to somehow reset the top & left coordinates for each iFrame level, I guess...
TheDewd
Posts: 849
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Internet Explorer get element under cursor (show borders, show text) (any zoom percentage)

14 Nov 2017, 14:42

I finally fixed the offset issue I was experiencing for the iFrames. The website I use only goes to 2 levels deep, so the following changes are working now!! ;)

I changed the following:

FROM:

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

oElt2 := oWin.document.elementFromPoint(vMouseX4, vMouseY4)


TO:

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

If (A_Index > 1) {
oElt2 := oWin.document.elementFromPoint(vMouseX4-vCtlX, vMouseY4-vCtlY)
} Else {
oElt2 := oWin.document.elementFromPoint(vMouseX4, vMouseY4)
}


Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus

User avatar
jeeswg
Posts: 4128
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Internet Explorer get element under cursor (show borders, show text) (any zoom percentage)

16 Apr 2018, 01:29

This is a copy of TheDewd's example zip from the 13 Nov 2017 post. The original file was called 'Example.zip', I renamed it to 'NestedFramesExample.zip'.
Attachments
NestedFramesExample.zip
(2.06 KiB) Downloaded 6 times
User avatar
jeeswg
Posts: 4128
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Internet Explorer get element under cursor (show borders, show text) (any zoom percentage)

16 Apr 2018, 01:45

- I finally had a chance to get back to the problem of nested frames, and frame/element coordinates, but it's still giving me trouble.
- There are 3 goals I would like to achieve:
-- get frame position
-- get element position
-- convert cursor position to a position that the WB object can handle
- I haven't really looked at the last 2 again yet. I want to understand getting the frame position first.

- This script tries to get the top-left coordinates of a frame and put a 300x300 box on it. It works fine at 100% zoom, and it's working on one or two frames on the Example.htm example from the zip above, at any zoom, but it gets one wrong slightly. I'm not really sure why it's going wrong, in case anybody can come up with some ideas.
- Btw the AutoHotkey documentation now uses frames, so it can be used for testing.
- Btw I've changed the JEE_Borders function to use 0xABCDEF (or 11259375) instead of "ABCDEF" for specifying RGB colour values. I.e. dec/hex numbers and not a 6-character string. A copy of the updated function is provided here.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


[EDIT:] Changed JEE_Borders to make it work in AHK v1.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: elbitjusticiero and 15 guests