Jump to content

Heavy IE.au3 usage results in Lock up.


Recommended Posts

Leaving the following script running does very strange things to my computer.. It will not allow my to right click on the desktop, Press Ctrl+Alt+Delete, It refuses to let my computer be shutdown without it being a Hard Reboot. I'm using WinXP Home SP3. I have a 3 ghz dual core processor and 3 gigs of Ram. Is there something obviously wrong in my code that would prevent extended usage? The code works, for all means it was made.. and will continue to work even when my computer has become unresponsive. However, when I terminate the script, my computer does not return to working order.

Is there a more efficient method for calling a direct URL query? Is there a more efficient method to go about what I am trying to accomplish? I am sorry for the novice coding. I am trying to get better. :P

#include <IE.au3>
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{Insert}", "Switch1")
HotKeySet("{Printscreen}", "Switch2")

; defined variables were here.

$num = 0
$tog = 0
Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is Paused. ' & $num & ' cycles.',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Switch1()
    If $tog = 1 Then $tog = 0
EndFunc
    
Func Switch2()
    If $tog = 0 Then $tog = 1
EndFunc
    
Func Jobs()

$oIE = _IECreate ("about:blank",0,$tog,1,0)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hosp_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $job_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $job2_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $job3_url)
_IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $benjob)
;~ _IELoadWait($oIE,1000)
_IENavigate ($oIE, $1job)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $2job)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $3job)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $4job)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $5job)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $6job)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $7job)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $8job)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $9job)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $10job)
_IELoadWait($oIE,1000)
_IEQuit($oIE)

EndFunc

Func Hits()
$oIE = _IECreate ("about:blank",0,$tog,1,0)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hosp_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hit_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hit2_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hit3_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hit)
_IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $1hit)
;~ _IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $2hit)
;~ _IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $3hit)
;~ _IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $4hit)
;~ _IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $5hit)
;~ _IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $6hit)
;~ _IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $7hit)
;~ _IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $8hit)
;~ _IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $9hit)
;~ _IELoadWait($oIE,1000)
;~ _IENavigate ($oIE, $10hit)
;~ _IELoadWait($oIE,1000)
_IEQuit($oIE)

EndFunc 

Func Hospital()
    
$oIE = _IECreate ("about:blank",0,$tog,1,0)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hosp_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hosp2_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hosp3_url)
_IELoadWait($oIE,1000)
_IEQuit($oIE)

EndFunc

Func Bank()
    
$oIE = _IECreate ("about:blank",0,$tog,1,0)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hosp_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $bank3_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $1bank)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $2bank)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $3bank)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $4bank)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $5bank)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $6bank)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $7bank)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $8bank)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $9bank)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $10bank)
_IELoadWait($oIE,1000)
_IEQuit($oIE)
    
EndFunc

Func Fight()
    
$oIE = _IECreate ("about:blank",0,$tog,1,0)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $hosp_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $fight_url)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $1fight)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $2fight)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $3fight)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $4fight)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $5fight)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $6fight)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $7fight)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $8fight)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $9fight)
_IELoadWait($oIE,1000)
_IENavigate ($oIE, $10fight)
_IELoadWait($oIE,1000)
_IEQuit($oIE)

EndFunc

while 1
    Jobs()
    Fight()
    Bank()
    Hospital()
    Hits()
$num = $num + 1
WEnd

Thanks a lot.

Jacob

Link to comment
Share on other sites

Suggest you try to reuse browsers instead of continually _IECreate and _IEQuit. The process creation is very resource intensive -- once the browser is there, _IENavigate is much less expensive.

From the looks of it you could

Global $oIE = _IECreate()
while 1
    Jobs()
    Fight()
    Bank()
    Hospital()
    Hits()
    $num = $num + 1
WEnd
_IEQuit($oIE)

and take all of the _IECreate and _IEQuits out of your functions.

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

Suggest you try to reuse browsers instead of continually _IECreate and _IEQuit. The process creation is very resource intensive -- once the browser is there, _IENavigate is much less expensive.

Dale

Thank you very much Dale. I've made the changes you suggest, I'll let the script run and see what happens. :P

Jacob

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...