Rogue Posted October 16, 2008 Share Posted October 16, 2008 Hi, What I am trying to do is copy the text from a .html page and save it as a .txt on my local drive or thumbdrive. This 'works' but I was wondering if there is better or more efficient way to do this or to possibly speed up the process? There may be six or eight total. $SD1 = FileOpen (@ScriptDir & "\SD1.txt",2) _IELoadWaitTimeout(15000) $oIE = _IECreate ("link1",0,0) if $oIE = 0 Then MsgBox (0," Error", "You Fool Is Wrong", 2) Else $sdf= _IEBodyReadText ($oIE) EndIf FileWrite($SD1,$sdf) FileClose ($SD1) _IEQuit ($oIE) $Na1 = FileOpen (@ScriptDir & "\Na1.txt",2) _IELoadWaitTimeout(15000) ;The initial is 30000 ms. $oIE1 = _IECreate ("link2",0,0) if $oIE1 = 0 Then MsgBox (0,"Error", "That one is wrong also", 2) Else $nav= _IEBodyReadText ($oIE1) EndIf FileWrite($Na1,$nav) FileClose ($Na1) _IEQuit ($oIE1) Thanks Link to comment Share on other sites More sharing options...
DaleHohm Posted October 17, 2008 Share Posted October 17, 2008 The most resource intensive part of using IE is the initial browser creation -- once it is up and running, it is pretty efficient. You are creating and destroying browsers repeatedly in your code... reuse the browser instead by simply using _IENavigate to go to you r new 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 More sharing options...
Rogue Posted October 17, 2008 Author Share Posted October 17, 2008 Thank you Dale that works much better. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now