Sign in to follow this  
Followers 0
RazerM

Embedded IE auto-scroll

3 posts in this topic

#1 ·  Posted (edited)

I am using IE embedded to have formatted text in my connect 4 online chat window. I am wondering is it possible to get it to automatically scroll to the bottom when new text is 'sent'.

#include <GUIConstants.au3>
#include <IE.au3>
GUICreate("Test GUI", 400, 230)
_IEErrorHandlerRegister()
$oIE = _IECreateEmbedded()
$GUI_IE = GUICtrlCreateObj($oIE, 10, 10, 380, 180)
_IENavigate($oIE, "about:blank")
_IEBodyWriteHTML($oIE, "<font color=#0000ff size=4>Welcome to Connect Chat!</font><br>")
$txt = GUICtrlCreateInput("", 10, 195, 315, 20)
$send = GUICtrlCreateButton("Send", 330, 195, 60, 20, $BS_DEFPUSHBUTTON)
GUISetState()

While 1
 Switch GUIGetMsg()
  Case $GUI_EVENT_CLOSE
   Exit
  Case $send
   $tosend = GUICtrlRead($txt)
   $old = _IEBodyReadHTML($oIE)
   _IEBodyWriteHTML($oIE, $old & "User: " & $tosend & "<br>")
   GUICtrlSetData($txt, "")
 EndSwitch
WEnd
Edited by RazerM

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites



Here is the magic you need:

$iDocHeight = $oIE.document.body.scrollHeight
   $oIE.document.parentwindow.scrollTo(0,$iDocHeight)

Place that in your code after your GUICtrlSetData($txt, "") command.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Thanks a lot


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

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
Sign in to follow this  
Followers 0