Jump to content

_IEPropertyGet screenx, screeny off in IE 11


Recommended Posts

For a while I thought this was caused by a security restriction in IE so I did not think much of it. But I was able to reproductive the problem using the help file scripts.

Basically, Using IE property get screenx, or screeny for IE 11 in windows 8 seem off a bit in the controls. See the attached Pics. This does not seem to be the case for my window 7 computer so I am wondering if this is some kind of setting?

 

; Open a browser with the form example and get a reference to the form
; textarea element.  Get the coordinates and dimensions of the text area,
; outline its shape with the mouse and come to rest in the center
#include <ScreenCapture.au3>
#include <IE.au3>
#RequireAdmin
Local $oIE = _IE_Example("form")

Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
Local $oTextArea = _IEFormElementGetObjByName($oForm, "textareaExample")

; Get coordinates and dimensions of the textarea
Local $iScreenX = _IEPropertyGet($oTextArea, "screenx")
Local $iScreenY = _IEPropertyGet($oTextArea, "screeny")
Local $iBrowserX = _IEPropertyGet($oTextArea, "browserx")
Local $iBrowserY = _IEPropertyGet($oTextArea, "browserY")
Local $iWidth = _IEPropertyGet($oTextArea, "width")
Local $iHeight = _IEPropertyGet($oTextArea, "height")

; Outline the textarea with the mouse, come to rest in the center
Local $iMousespeed = 50
MouseMove($iScreenX, $iScreenY, $iMousespeed)
MouseMove($iScreenX + $iWidth, $iScreenY, $iMousespeed)
MouseMove($iScreenX + $iWidth, $iScreenY + $iHeight, $iMousespeed)
MouseMove($iScreenX, $iScreenY + $iHeight, $iMousespeed)
MouseMove($iScreenX, $iScreenY, $iMousespeed)
MouseMove($iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, $iMousespeed)
_ScreenCapture_Capture(@MyDocumentsDir & "\GDIPlus_Image2.jpg", $iScreenX, $iScreenY, $iScreenX + $iWidth, $iScreenY + $iHeight)
ShellExecute(@MyDocumentsDir & "\GDIPlus_Image2.jpg")

The top image is from windows 7, and the bottom is window 8.

IE 11 win 7.jpg

IE 11 win 8.jpg

Edited by uncommon

No problem can withstand the assault of sustained thinking.Voltaire

_Array2HTMLTable()_IEClassNameGetCollection()_IEquerySelectorAll()

Link to comment
Share on other sites

Are you saying I should try resizing the window my using something like winmove? I am not sure I understand how to correct the problem?

try WinMove('_IE_Example("form") - Windows Internet Explorer','',10,10) just after you create browser, it wont work, the coords are created from inside the explorer window

maybe a quick fix? =P

if windows8 then
$iScreenX=$iScreenX-10
$iScreenY=$iScreenY-10
endif

or you could look up on _IEPropertyGet inside IE.au3 of autoit's includes folder and look how it calculates the values and see if you can come up with an alternative, i don't have win8 but your script works fine on my win7 with my old InternetExplorer 9

Link to comment
Share on other sites

try WinMove('_IE_Example("form") - Windows Internet Explorer','',10,10) just after you create browser, it wont work, the coords are created from inside the explorer window

maybe a quick fix? =P

if windows8 then
$iScreenX=$iScreenX-10
$iScreenY=$iScreenY-10
endif

or you could look up on _IEPropertyGet inside IE.au3 of autoit's includes folder and look how it calculates the values and see if you can come up with an alternative, i don't have win8 but your script works fine on my win7 with my old InternetExplorer 9

Well yeah I could add some offsets to make it work correctly in this instance, but this is a reproduction of the problem. The scripts I use are more complicated and are deployed over many computers. Fixing like this would not fix it for all of them.

What I'm saying is the coordinates are correct, you can see that with the mouse moving around its boundaries, it's just not visible.

For me the mouse moves outside the control like the picture I attached. How could this control not be visible? I don't see any tag attributes that would make it partly invisible...?

2015-08-02_1506.png

No problem can withstand the assault of sustained thinking.Voltaire

_Array2HTMLTable()_IEClassNameGetCollection()_IEquerySelectorAll()

Link to comment
Share on other sites

I gave IE.au3 a quick look and something cached my eye, the '$oTemp.offsetLeft' for example, a quick search in msdn lead to https://msdn.microsoft.com/en-us/library/ms533564(v=vs.85).aspx see remarks(The difference between the offsetLeft and clientLeft properties is the border of the object.) , and maybe win8 also calculates the border diferently than win7, idk

I tried the alternative of offsetLeft which is clientLeft, it seems to create me (in win7) the problem you have in win8 xD

; Get coordinates and dimensions of the textarea
Local $iScreenX = _IEPropertyGet($oTextArea, "screenx")
ConsoleWrite("$iScreenX="&$iScreenX&@lf)

;out from IE.au3 udf to calculate screenx
$oTemp = $oTextArea
$iTemp = 0
While IsObj($oTemp)
;~  $iTemp += $oTemp.offsetLeft     ;_IEPropertyGet uses this one
    $iTemp += $oTemp.clientLeft     ;alternative one i tested
    $oTemp = $oTemp.offsetParent
WEnd
$iScreenX_2 = $iTemp + $oTextArea.document.parentWindow.screenLeft
ConsoleWrite("$iScreenX_2="&$iScreenX_2&@lf)
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

×
×
  • Create New...