Jump to content

IE screenx property messes up if you scroll, how to fix?


dusty071
 Share

Recommended Posts

Hi, im trying to find the exact coordinates of IE object on the screen. _IEPropertyGet($oDiv, "screeny") gets the closest, since its correct until you scroll down. The coordinates stay in place even if you scroll, making the screen coordinates of that element wrong the moment you start scrolling. Ive been trying to find the current number of pixels that the page is scrolled and then add it to the screeny property, but none of the functions im finding dont seem to return the current scrolled value. I tried $oIE.document.window.pageYOffset , .scrolltop, etc. Maybe im not using them correctly, or they just dont work. Help much appreciated.

Link to comment
Share on other sites

You have to recalculate after Each Scroll

I had an idea for you may you can use

#include <Misc.au3>

If _Ispressed ("***") 

Then "recalculate"

The only unknow thing is, i am not sure you have an exa code for the mouse scroll ... "?"

Or even maybe that :

If MouseWheel ( "up") or MouseWheel ( "down")

Then "recalculate "
Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

Example:

#include <IE.au3>

HotKeySet("{NUMPADADD}", "_mousemove")

$oIE = _IECreate("http://www.autoitscript.com/forum/topic/164509-ie-screenx-property-messes-up-if-you-scroll-how-to-fix/")
$oDiv = _IEGetObjById($oIE, "post_id_1200002")

;if i use scrollintoview which i need to, the coords get wrong since any type of scrolling ruins screenx and screeny
;_IEAction($oDiv, "scrollintoview")

While 1
   ToolTip("screenx: " & _IEPropertyGet($oDiv, "screenx") & "  screeny: " & _IEPropertyGet($oDiv, "screeny"), 0, 0)
   Sleep(1000)
WEnd

Func _mousemove()
      MouseMove(_IEPropertyGet($oDiv, "screenx"), _IEPropertyGet($oDiv, "screeny"), 0)
EndFunc

You can use numpad+ to test the coords. You can see that the coords are correct even if you move the window around, but the moment you do any type of scrolling the coords are ruined. I think i only need the number of pixels that the page is scrolled at the moment so that i can add it to the screeny.

Link to comment
Share on other sites

You can use numpad+ to test the coords. You can see that the coords are correct even if you move the window around, but the moment you do any type of scrolling the coords are ruined. I think i only need the number of pixels that the page is scrolled at the moment so that i can add it to the screeny.

 

Try coordinate mode with windows and use the methode i said you , logicaly it should work.

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

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