Jump to content

IE.au3 and _IEDocWriteHTML in a loop


NELyon
 Share

Recommended Posts

I'm writing an HTML editor for my friend. He's a web designer, but he does his work at school computers where he doesen't have access to dreamweaver, so i made this little WYSIWYG editor for him. There's a problem though, it keeps on refreshing so if you have a large file, it will keep scrolling to the top of the page. Can anyone help with this?

#include <GUIConstants.au3>
#include <IE.au3>
#include <Misc.au3>
$oIE = _IECreateEmbedded()
$GUI = GUICreate("HTML Editor", 700, 700)
$Edit = GUICtrlCreateEdit("", 0, 10, 700, 350)
GUICtrlCreateObj($oIE, 0, 360, 700, 350)
_IENavigate($oIE, "http://codemyster.zapto.org/blank.html")
GUISetState()

While 1
    If $cmdline[0] <> 1 Then
        ExitLoop
    Else
        GUICtrlSetData($Edit, FileRead($cmdline[1]))
        ExitLoop
    EndIf
    
WEnd

While 1
    Sleep(10)

    _IEDocWriteHTML($oIE, GUICtrlRead($Edit))
WEnd
Edited by D-Generation X
Link to comment
Share on other sites

What do you want it to do?

Dale

p.s. your animated GIF avitar makes it very difficult for me to read your posts... I have an aversion to things that move on the screen and something that changes that quickly just grabs my eyes and won't let go...

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

Link to comment
Share on other sites

So top is good?

$oIE.document.parentwindow.scroll(0,0)

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

Link to comment
Share on other sites

I'm trying to keep it from scrolling back up to the top. I want it to stay in the same place when it refreshes.

Ah, ok then,

$iScrollTop = $oIE.document.body.scrollTop
$oIE.document.parentwindow.scroll(0,$iScrollTop)

Dale

p.s. you can find info on these properties in the MSDN docs in my sig

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

Link to comment
Share on other sites

Ah, ok then,

$iScrollTop = $oIE.document.body.scrollTop
$oIE.document.parentwindow.scroll(0,$iScrollTop)
Sorry, I should have stated that those commands need to be split up... the first saves the current scroll position, the second should be executed after the refresh to set the scroll position back to the desired location.

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...