Sign in to follow this  
Followers 0
WSCPorts

Getting a about:blank Document Object?

4 posts in this topic

@dale ok i was wondering if this would work doing a http request then automating IE.document.InnerHtml to = the result here the code im using ur udf on 2003 sever sp_1 build 3.1.1.63 No IE pops up ? i got IE to pop up with vbs though

now that im back to programming bc i got alot of time on my hands i discovered i remebered alot of random stuff so i reseached it all again now i remember alot of crazy stuff especially about the DOM if fact in one of my class at school i used the DOM and js to make a Phantom Html Application u could insert any html into any part of the screen it also had a save and reset function but my most prided thing was that it could call other html pages into it and be almost like a sever / client

in essence i made a realtime html editor that inserted "Text" that got interpreted by IE as html. if i can find the code ill post what i think u wil find useful but for now the current problem is here

#include IE.au3
func getHttpTextToIE($strURL)
Dim $objError = @Error
Dim $oDoc, $iE
    Dim $strResult;
    
        
       ; Create the WinHTTPRequest ActiveX Object.
        dim $WinHttpReq = ObjCreate("WinHttp.WinHttpRequest.5.1")
       ;  Create an HTTP request.
        Dim $temp = $WinHttpReq.Open("GET", $strURL, false)

       ;  Send the HTTP request.
        $WinHttpReq.Send()
        
       ;  Retrieve the response text.
        $strResult = $WinHttpReq.ResponseText
   
    
   ; Return the response text To Ie.
return $strResult

$oIE = _IECreate()
$oDoc = _IEDocumentGetObj($oIE)
$oDoc.innerhtml = $strResult
 
   If @Error = 1 then 
    MsgBox(2, "Error Raised", $strResult)       
Exit
Endif
EndFunc
dim $objText = getTextToIE("http://www.google.com")

http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

So this isn't really very useful (graphic doesn't display and form action is invalid), but how close is it to what you are trying to do?

Dale

#include <IE.au3>

; Create an invisible IE, browse to Google, get HTML and quit
$oIE = _IECreate(0)
_IENavigate($oIE, "http://www.google.com")
$sGoogle = _IEBodyReadHTML($oIE)
_IEQuit($oIE)

; Open a new IE on blank page, write Google HTML to it
$oIE2 = _IECreate()
_IEBodyWriteHTML($oIE2, $sGoogle)

Here's a sample of rewriting a page in place:

#include <IE.au3>

; Create an invisible IE, browse to Google, get HTML, append to it and make it visible
$oIE = _IECreate(0)
_IENavigate($oIE, "http://www.google.com")
$sGoogle = _IEBodyReadHTML($oIE)
$newHTML = "<p><center><b>Look at me!  I can rewrite pages!</b></center>"
_IEBodyWriteHTML($oIE, $sGoogle & $newHTML)
_IEAction($oIE,"visible")
Edited by DaleHohm

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

#3 ·  Posted (edited)

somewhat close but here wwhat i was trying to do but i want not to use IE to navigate anywhere i wanted to see the text in IE that my own httpRequest had gotten um a excellent Get source utility? :) but w/e here a working version

maybe this could be used to Include UDF's from the internet instead of having to download then they could be accessed via Http?

[code#include <IE.au3>

func TextToIE($strURL)

Dim $oDoc

Dim $strResult

; Create the WinHTTPRequest ActiveX Object.

dim $WinHttpReq = ObjCreate("WinHttp.WinHttpRequest.5.1")

; Create an HTTP request.

Dim $temp = $WinHttpReq.Open("GET", $strURL, false)

; Send the HTTP request.

$WinHttpReq.Send()

; Retrieve the response text.

$strResult = $WinHttpReq.ResponseText

; Return the response text To Ie.

$o_object = _IECreate()

With $o_object

.Navigate("about:blank")

Sleep(2000)

.document.Write( $strResult )

EndWith

If @Error = 1 then

MsgBox(2, "Error Raised", @Error)

Exit

Endif

return $strResult

EndFunc

MsgBox(0, "IEAutoit", TextToIE("http://www.autoitscript.com/forum/index.php?showtopic=13981"))

Edited by WSCPorts

http://www.myclanhosting.com/defiasVisit Join and contribute to a soon to be leader in Custumized tools development in [C# .Net 1.1 ~ 2.0/C/C++/MFC/AutoIt3/Masm32]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

somewhat close but here wwhat i was trying to do but i want not to use IE to navigate anywhere i wanted to see the text in IE that my own httpRequest had gotten um a excellent Get source utility? :) but w/e here a working version

maybe this could be used to Include UDF's from the internet instead of having to download then they could be accessed via Http?

<{POST_SNAPBACK}>

Thanks for the ideas. Using WinHttp.WinHttpRequest directly will certainly be faster than instantiating a browser window to get the source, but at least for IE.au3 I'm not anxious to open a new can of worms with a new object. Also remember that we already have the InetGet function builtin to AutoIt that retrieves a file over the internet.

The same result can be achieved with InternetExplorer and the DOM:

#include <IE.au3>

; Create an invisible IE, browse to Google, get HTML and quit
$oIE = _IECreate(0)
_IENavigate($oIE, "http://www.google.com")
$sGoogle = $oIE.document.getElementsByTagName("HTML").item(0).outerHTML
_IEQuit($oIE)

; Open a new IE on blank page, write Google HTML to it
$oIE2 = _IECreate()
$oIE2.document.Write($sGoogle)
$oIE2.document.close()

Exit

Or enven faster by reusing the original browser:

#include <IE.au3>

; Create an invisible IE, browse to Google, get HTML
$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")
$sGoogle = $oIE.document.getElementsByTagName("HTML").item(0).outerHTML
; Browse to the blank document, write the Google HTML, close the document (housekeeping)and set visible
_IENavigate($oIE, "about:blank")
$oIE.document.Write( $sGoogle )
$oIE.document.close()
_IEAction($oIE, "visible")

Exit

Edit: Added reference to InetGet function...

Edited by DaleHohm

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

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