Jump to content

Recommended Posts

Posted (edited)

How can you scroll to the end of a text area in IE without using focus/ControlSend? I have tried several solutions (see code below) but I can't seem to get them to work.

Test HTML (test.html)

<!DOCTYPE html>
<html>
    <body>
        <textarea id="textarea-test" rows="4" cols="50">
        </textarea>
    </body>
</html>

 

AutoIt Test Code:

#RequireAdmin
#include <IE.au3>

$oIE = _IECreate(@ScriptDir & "\test.html")

Local $hWnd = _IEPropertyGet($oIE, "hwnd")

Local $oTextarea = _IEGetObjById($oIE, "textarea-test")

Local $sText = ""
For $i = 1 To 30
    $sText &= $i & "&#13;&#10;"
    _IEPropertySet($oTextarea, "innerhtml", $sText)

    ;NOT WORKING
    ;$oTextarea.document.parentwindow.scroll(0, 99999)
    ;_IEAction($oTextarea, "scrollintoview")

    ;NOT WORKING
    ;$iDocHeight = $oTextarea.document.body.scrollHeight()
    ;$oTextarea.document.parentwindow.scrollTo(0, $iDocHeight)

    ;NOT WORKING
    ;$oTextarea.document.parentwindow.scrollTo(0, 99999)

    ;NOT WORKING
    ;$oTextarea.scrollintoview()

    ;WORKING
    _IEAction($oTextarea, "focus")
    ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "^{end}")

    Sleep(100)
Next

 

 

Edited by Herb191
edited code
Posted

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
×
×
  • Create New...