在 AutoIT 中无法为 DIV 获取 screenx 属性
Can't get screenx property for DIV in AutoIT
我正在尝试获取 ID=1862 的 DIV 的屏幕坐标,以便在 AutoIT 中单击它。以下是我如何查看 DIV 中的文本,以便我知道它可以检测到它:
local $element=_IEGetObjById($oIE, "ember1862")
_IEFormElementSetValue($element, "Eric")
成功重置搜索框中的值。
但是当我尝试点击它时:
_IEAction($element, "click")
或
$element.click
它什么都不做。
当我尝试获取坐标时,它总是告诉我它们都是 0,我知道这不是真的(它位于页面中间):
local $search = _IEGetObjById($oIE, "ember1862")
MsgBox(0,"",_IEPropertyGet($search,"screenx"))
有什么建议吗?
我不确定为什么但这个功能起作用了---
获取坐标的函数:
func _IEfindPosX($o_object)
local $curleft = 0
local $parent = $o_object
if IsObj($parent) then
while IsObj($parent)
$curleft += $Parent.offsetLeft
$parent = $Parent.offsetParent
wend
else
local $objx = $o_object.x
if IsObj($objx) then $curleft += $objx
EndIf
return $curleft
EndFunc
遍历所有 html 输入以获得 x 坐标:
$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
MsgBox(0,"",$oInput.id)
MsgBox(0,"",_IEfindPosX($oInput))
Next
我正在尝试获取 ID=1862 的 DIV 的屏幕坐标,以便在 AutoIT 中单击它。以下是我如何查看 DIV 中的文本,以便我知道它可以检测到它:
local $element=_IEGetObjById($oIE, "ember1862")
_IEFormElementSetValue($element, "Eric")
成功重置搜索框中的值。
但是当我尝试点击它时:
_IEAction($element, "click")
或
$element.click
它什么都不做。
当我尝试获取坐标时,它总是告诉我它们都是 0,我知道这不是真的(它位于页面中间):
local $search = _IEGetObjById($oIE, "ember1862")
MsgBox(0,"",_IEPropertyGet($search,"screenx"))
有什么建议吗?
我不确定为什么但这个功能起作用了---
获取坐标的函数:
func _IEfindPosX($o_object)
local $curleft = 0
local $parent = $o_object
if IsObj($parent) then
while IsObj($parent)
$curleft += $Parent.offsetLeft
$parent = $Parent.offsetParent
wend
else
local $objx = $o_object.x
if IsObj($objx) then $curleft += $objx
EndIf
return $curleft
EndFunc
遍历所有 html 输入以获得 x 坐标:
$oInputs = _IETagNameGetCollection ($oIE, "input")
For $oInput In $oInputs
MsgBox(0,"",$oInput.id)
MsgBox(0,"",_IEfindPosX($oInput))
Next