Shevilie Posted April 26, 2007 Share Posted April 26, 2007 Hey I'm looking for a way to remove and write stuff to a internet page before it gets show.. Rigth now i got this #include <IE.au3> $oIE = _IECreate("http://www.google.com") $carrier = _IEBodyReadHTML($oIE) $carrier = StringReplace($carrier, "Google", "NEW GOOGLE") _IEBodyWriteHTML($oIE, $carrier) But as you see the normale page is getting loaded and is visible before my changes is made, is there a way to get the page source, change the html then show it. I tried _INetGetSource, but then the pictures wouldnt load, and I have to change all URL etc.. That was a mess Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Bert Posted April 26, 2007 Share Posted April 26, 2007 I like to see the answer to this myself. I have a similar coding problem myself. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Shevilie Posted April 27, 2007 Author Share Posted April 27, 2007 I thouhgt of i double browser.. one hidden loading the stuff and then one that is visible.. though i get problems with link and images etc.. Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
nooby Posted April 27, 2007 Share Posted April 27, 2007 Sloppy way: InetGetSource, and proceed to replace the text within the source string (to whatever you want to change), and finally.. something like this? FileWrite(@ScriptDir & "\New.htm", $SourceString) While NOT FileExists(@ScriptDir & "\New.htm") ;Avoid running the file before it's created Sleep(5) WEnd ShellExecute(@ScriptDir & "\New.htm") Just giving some (sloppy) ideas. Link to comment Share on other sites More sharing options...
Shevilie Posted April 27, 2007 Author Share Posted April 27, 2007 No you cant use that... you will still have problems with the link and images since they are relative path.... Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
jvanegmond Posted April 27, 2007 Share Posted April 27, 2007 I got it on the first attempt... #include <IE.au3> #include <INet.au3> $HTML = _INetGetSource("www.google.com") $HTML = StringReplace($HTML,"Google", "Manadar") $oIE = _IECreate("www.google.com", 0,0,1) _IEBodyWriteHTML($oIE,$HTML) _IEAction($oIE, "visible") github.com/jvanegmond Link to comment Share on other sites More sharing options...
Bert Posted April 27, 2007 Share Posted April 27, 2007 In researching this, I find _IEDocWriteHTML will replace the entire HTML that is seen. You could read the HTML, then rewrite what you want with the captured data The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Shevilie Posted April 27, 2007 Author Share Posted April 27, 2007 In researching this, I find _IEDocWriteHTML will replace the entire HTML that is seen. You could read the HTML, then rewrite what you want with the captured dataNow have a look what I'm doing in the top Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 27, 2007 Share Posted April 27, 2007 Did you see Manadar's answer in post #6? It seems to work. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Shevilie Posted April 27, 2007 Author Share Posted April 27, 2007 Youre still not loading the html.. if you remove a large object there will still be white space where the object was Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
jvanegmond Posted April 27, 2007 Share Posted April 27, 2007 Youre still not loading the html.. if you remove a large object there will still be white space where the object was That is definitely an error on your part. This code removes the image tags from Google, and there isn't any white space at all. #include <IE.au3> #include <INet.au3> $HTML = _INetGetSource("www.google.com") $HTML = StringRegExpReplace($HTML, "<img.*?>", "") $oIE = _IECreate("www.google.com", 0,0,1) _IEBodyWriteHTML($oIE,$HTML) _IEAction($oIE, "visible") You have to keep in mind that the website may be using CSS to space and place 'modules' on their website. If you remove one of these modules, you will leave a white space, as the CSS tells the browser that that space has to be there! github.com/jvanegmond Link to comment Share on other sites More sharing options...
Shevilie Posted April 27, 2007 Author Share Posted April 27, 2007 Ye it use CSS, but I'm removing the divs.. Hmm but I can see your right, well thx for the help Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
naru Posted March 15, 2018 Share Posted March 15, 2018 On 4/27/2007 at 4:17 AM, Shevilie said: Hey I'm looking for a way to remove and write stuff to a internet page before it gets show.. Rigth now i got this #include <IE.au3> $oIE = _IECreate("http://www.google.com") $carrier = _IEBodyReadHTML($oIE) $carrier = StringReplace($carrier, "Google", "NEW GOOGLE") _IEBodyWriteHTML($oIE, $carrier) But as you see the normale page is getting loaded and is visible before my changes is made, is there a way to get the page source, change the html then show it. I tried _INetGetSource, but then the pictures wouldnt load, and I have to change all URL etc.. That was a mess try This : #include <IE.au3> $oIE = _IECreate() WinSetState("[CLASS:IEFrame]", "", @SW_HIDE) _IENavigate($oIE, "http://www.google.com") $carrier = _IEBodyReadHTML($oIE) $carrier = StringReplace($carrier, "Google", "NEW GOOGLE") _IEBodyWriteHTML($oIE, $carrier) WinSetState("[CLASS:IEFrame]", "", @SW_SHOW) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 15, 2018 Moderators Share Posted March 15, 2018 (edited) @Nareshm Why would you resurrect a thread after 11 years?! Especially when the OP has already been provided an answer. You have been around long enough to know better; please think before you post next time. Edited March 15, 2018 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts