Opened 11 years ago
Closed 11 years ago
#2959 closed Bug (Works For Me)
IE and GUI
| Reported by: | grzesiek | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.12.0 | Severity: | None |
| Keywords: | ie, gui | Cc: |
Description
Opt("GUIOnEventMode", 1)
GUICreate("test", 200, 200)
GUISetOnEvent(-3, "CloseEvent")
$cLabel = GUICtrlCreateLabel("0", 9, 10)
GUICtrlCreateButton(" Stop ", 9, 50)
GUICtrlSetOnEvent(-1, "CloseEvent")
GUISetState()
$oIE = ObjCreate("InternetExplorer.Application")
;$oIE.Visible = 1
$i = 0
Do
$oIE.Navigate("https://www.autoitscript.com/site/")
Do
Sleep(200)
Until $oIE.ReadyState > 2
$oDocument = $oIE.Document
Do
Sleep(200)
Until $oDocument.ReadyState = "complete"
$oLinks = $oDocument.GetElementsByTagName("a")
For $oLink In $oLinks
Next
$i += 1
GUICtrlSetData($cLabel, $i)
Until 0
Func CloseEvent()
If IsObj($oIE) Then $oIE.Quit()
Exit
EndFunc
When I run this script the GUI is less responsive and what more important when I minimize the GUI it often doesn't want to restore, I just hear the sound like when the GUI is disabled and I click on it, so I can't minimize the GUI because of this problem. What helps a lot is adding more sleep to the script, changing Sleep(200) to Sleep(1000), but then the script has to take more time to finish and even if I add more sleep it doesn't solve problem completly. I checked this on three computers and there is the same problem, on older computer with Windows XP it's even worse, the GUI is hanging a lot, a lot of problem dragging the GUI. What is causing this and how can I completly solve this? The problem is connected with using IE object, because when I run some script which doesn't use IE it doesn't cause this problem even if the script takes a lot of CPU. I didn't receive any response on the forum so I'm writing here.
I don't have this problem here:
Opt("GUIOnEventMode", 1)
GUICreate("test", 200, 200)
GUISetOnEvent(-3, "CloseEvent")
$cLabel = GUICtrlCreateLabel("0", 9, 10)
GUICtrlCreateButton(" Stop ", 9, 50)
GUICtrlSetOnEvent(-1, "CloseEvent")
GUISetState()
$i = 0
$iTimer = TimerInit()
Do
If TimerDiff($iTimer) > 2000 Then
$i += 1
GUICtrlSetData($cLabel, $i)
$iTimer = TimerInit()
EndIf
Until 0
Func CloseEvent()
Exit
EndFunc

"I didn't receive any response on the forum so I'm writing here"
Wrong thing to do - Trac is not for support. Next time bump your thread at least once.
And your script works fine for me with none of the problems you describe - so perhaps for everyone else too, which is why you got no response.
M23