Jump to content
Herb191

Internet Explorer text area scroll?

Recommended Posts

Herb191

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

Share this post


Link to post
Share on other sites
Danyfirex

This work for me. 

$oTextarea.scrollTop = 99999

Saludos

  • Like 1

Share this post


Link to post
Share on other sites
Herb191
2 minutes ago, Danyfirex said:

This work for me. 

$oTextarea.scrollTop = 99999

Saludos

It works for me too. Very cool. Thank you.

Share this post


Link to post
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

  • Similar Content

    • Joro
      By Joro
      Hi,
      I'm struggeling with the following:
      In a website I have to fill in several items. For the normal fields I am able to fill in the information by using UDF "_IEGetObjByName".
      But there is also a dropdown menu and I can't figure out how to choose te right information from it. I have searched the helpfile and the forum but I can't figure it out.
      Here's an excerpt  from the html-page of the site where the dropdown-menu is mentioned:
      <div class="col-md-10 padding-5">
       <div class="btn-group m-r">
        <input type="hidden" name="bedrijfId" class="bedrijfId" value="">
                  <button type="button" data-toggle="dropdown" class="btn btn-sm btn-default dropdown-toggle" >
                       <span class="dropdown-label">Choose Company</span>
                       <span class="caret"></span>
                  </button>
                        <ul class="dropdown-menu dropdown-select" >
                             <li  data-value="2" data-field="bedrijfId"><a href="#"><input type="radio" name="drp1" />Company 1</a></li>
                             <li  data-value="38" data-field="bedrijfId"><a href="#"><input type="radio" name="drp1" />Company 2</a></li>
                             <li  data-value="42" data-field="bedrijfId"><a href="#"><input type="radio" name="drp1" />Company 3</a></li>
                        </ul>
          </div>
      </div>
       
      How do I select one of the companies from the dropdown menu?
      Thanks
      Joost
    • mLipok
      By mLipok
      I have some problems with windows explorers.
      Here is my testing snippet:
      ;~ #RequireAdmin _Example() MsgBox(1, '', '@error = ' & @error & @CRLF & '@extended = ' & @extended) Func _Example() Local $oShell = ObjCreate("shell.application") If @error then Return SetError(1, @extended, 0) Local $oShellWindows = $oShell.windows If @error then Return SetError(2, @extended, 0) If $oShellWindows = Null Then Return SetError(3, 0, 0) Local $iCount = $oShellWindows.Count If @error then Return SetError(4, $iCount, 0) Return SetExtended($iCount,1) EndFunc ;==>_Example Normally this should return in extended number of opened InternetExplorer + WindowsExplorer.
      But in some cases I encounter a problem with this, as there happens situation when @extended returns 0 even if I had already opened IE.
      Here is one of them:
      I have some script which is working fine with IE on about 100 computers.
      In this specyfic case this script starts his work, and after few minutes he stoped works.
      All the time IE is still responsive, I can click on elements and go to specyfic places.
      Restoring the script did not help because _IEAttach () does not work.
      All you need to do is restart InternetExplorer.
       
      As a result of all my investigation I had done you can see this script snippet above.
      In my case My primary script was doing their job, but when he stops, IE was still responsive but this above snippet starts to return @error=0 and @extended = 0 when @extended should be at least =1 (this opened Internet Explorer instance)
      QUESTION:
      Has anyone already encountered such a problem?
      Does anyone know any solution or has an idea for further diagnostics?
       
      btw.
      I have one solution which would fix it - I mean Windows reinstall, but this is not good solution, as I always like to know the esense of the problem.
       
      EDIT:
      I know you can say show the script........ this is not possible you have no access to this site, and about 100 computers works well, so this i not related to my script.
      The more so that the problem is not related to my main scripts, and the problem is simply how IE behaves - which is illustrated by the above piece of code.
       
    • rudi
      By rudi
      Hello,
      usually I do Win automations, so I have no skills at all to handle HTML forms :-/
      The script to catch and syntax check  the required information from Excel is done.
      Now I'd like to automate the upload using this form, too:
       
      http://flashcardsdeluxe.com/flashcards/Upload.aspx
      What browser is easiest to do so? (IE, Chrome, FF) The Values $DeckCode, $DeckName, $DeckDefinition shall go to their HTML form fields finally "click" the button "upload flashcards" <table width="70%" class="cssCenter" border="0"> <tr> <td style="width: 1%">Deck&nbsp;Code</td> <td style="width: 100%"><input name="ctlDeckCode" type="text" id="ctlDeckCode" style="width:50%;" /> (no spaces allowed)</td> <td></td> </tr> <tr> <td style="width: 1%">Deck&nbsp;Name</td> <td style="width: 100%"><input name="ctlDeckName" type="text" id="ctlDeckName" style="width:50%;" /> (optional)</td> <td style="width: 1%" align="right"><input type="submit" name="ctlUpload" value="Upload Flashcards" id="ctlUpload" /></td> </tr> <tr> <td valign="top" style="padding-top: 5px" >Flashcard&nbsp;Text</td> <td colspan="2"><textarea name="ctlFlashcardText" rows="2" cols="20" id="ctlFlashcardText" style="height:280px;width:100%;"></textarea></td> </tr> </table> If someone kindly could jump in showing how to address just one of the input fields and how to "click" the "upload flashcards" button, I should be able to do the rest myself.
      TIA, Rudi.

    • Nareshm
      By Nareshm
      i want to repeat this function 
      _IELoadWait($oIE, "url 2") $checkb = _IEGetObjById($oIE,"checkb") _IEAction($checkb,"click") $img = _IEGetObjById($oIE,"img") _IEAction($img,"click") _IELoadWait($oIE, "url 1") $btnfy = _IEGetObjById($oIE,"btnvfy") _IEAction($btnfy,"click") until my targeted webpage not found.
    • Robdog1955
      By Robdog1955
      I'm trying to click a button on a web page. I have added a couple of MsgBox lines to allow me to watch what happens on the page. As you can see the first half of my script enters data into text boxes on the page. I have no problem there. I just cannot click on the region buttons. The "set focus" line causes an outline to appear around the EU button and the "click button" line causes the "Pick a Region" text to disappear. Here is the code I have so far.
      #include <IE.au3> Local $oIE = _IECreate("http://questchecker.com/") Local $iQuestID = "123456" Local $sCharacterName = "CharacterName" Local $colForms = _IEFormGetCollection($oIE) $iCount = 0 For $oForm In $colForms $oFormElements = _IEFormElementGetCollection($oForm) For $oFormElement In $oFormElements $iCount = $iCount + 1 Local $sTagName = StringLower($oFormElement.tagName) Local $sElementType = $oFormElement.type Local $sElementName = $oFormElement.name Switch $iCount Case 6 _IEFormElementSetValue($oFormElement, "MyRealm", 0) ; realm Case 7 _IEFormElementSetValue($oFormElement, $sCharacterName, 0) Case 8 _IEFormElementSetValue($oFormElement, $iQuestID, 0) EndSwitch Next Next Local $oButtons = _IEGetObjByName($oIE, "questForm") For $oButton In $oButtons If _IEFormElementGetValue($oButton) = "US" Then MsgBox(0, "", "Click Okay to set focus") _IEAction($oButton, "focus") MsgBox(0, "", "Click Okay to click button") _IEAction($oButton, "click") ExitLoop EndIf Next MsgBox(0, "", "Click Okay to quit") _IEQuit($oIE) Exit  
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.