Hasher Posted February 12, 2007 Share Posted February 12, 2007 Hi I am making a little app that monitors a webpage. It uses a while loop to reside in memory until the desired action is performed by user. The probelm I have is that it takes up 100% of the memory and makes the computer lock up. From previous posts I read one option is to put sleep(10) in the loop but this has not worked. Any suggestions ?? #include <IE.au3> HotKeySet("{ESC}","KillMe") $sWebPage = "http://www.google.com" $i = 1 $oIE = _IECreate() _IENavigate($oIE, $sWebPage) While $i = 1 sleep(10) $oEvent = ObjEvent($oIE, "onsubmit") if $oEvent = true then IEEvent_onbeforeunload() WEnd Func IEEvent_onbeforeunload() MsgBox(0,"success","onsubmit worked") EndFunc Func KillMe() Exit EndFunc Thank you in advance .. Paul :-D Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of shhh extensions! Link to comment Share on other sites More sharing options...
BrettF Posted February 12, 2007 Share Posted February 12, 2007 Increase the Sleep?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Hasher Posted February 12, 2007 Author Share Posted February 12, 2007 If I do that it can 'miss' my if statement Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of shhh extensions! Link to comment Share on other sites More sharing options...
FreeFry Posted February 12, 2007 Share Posted February 12, 2007 (edited) Judging from this list: http://msdn.microsoft.com/library/default..../reflist_vb.asp, there's no such event called "onbeforeunload", neither one such as "onsubmit"(javascript?).And even if it does, you are defining the event handler the wrong way, it's not meant to be used in a loop like that - you use it once, after creating the object it should handle.This is how it should be defined(assuming that the events exists):$oIE = _IECreate() $oEvent = ObjEvent($oIE, "IEEvent_") Func IEEvent_onbeforeunload() MsgBox(0,"success","onsubmit worked") EndFunc Func IEEvent_onsubmit() MsgBox(0,"success","onsubmit worked") EndFuncThat "onsubmit" event looks like javascript, and as far as I am aware, javascript is not connected to the "InternetExplorer.Application.1" object - that the IE.au3 functions uses - in any way.Edit:Clarified. Edited February 12, 2007 by FreeFry Link to comment Share on other sites More sharing options...
MrCreatoR Posted February 12, 2007 Share Posted February 12, 2007 (edited) HasherTry This:#include <IE.au3> HotKeySet("{ESC}","KillMe") $sWebPage = "http://www.google.com" $i = 1 $oIE = _IECreate() _IENavigate($oIE, $sWebPage) AdlibEnable("Loop", 10) While 1 Sleep(100) Wend Func Loop() $oEvent = ObjEvent($oIE, "onsubmit") if $oEvent = true then IEEvent_onbeforeunload() EndFunc Func IEEvent_onbeforeunload() MsgBox(0,"success","onsubmit worked") EndFunc Func KillMe() Exit EndFunc Edited February 12, 2007 by MsCreatoR Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
FreeFry Posted February 12, 2007 Share Posted February 12, 2007 Hasher Try This: #include <IE.au3> HotKeySet("{ESC}","KillMe") $sWebPage = "http://www.google.com" $i = 1 $oIE = _IECreate() _IENavigate($oIE, $sWebPage) AdlibEnable("Loop", 10) While 1 Sleep(100) Wend Func Loop() $oEvent = ObjEvent($oIE, "onsubmit") if $oEvent = true then IEEvent_onbeforeunload() EndFunc Func IEEvent_onbeforeunload() MsgBox(0,"success","onsubmit worked") EndFunc Func KillMe() Exit EndFunc This still does hang the cpu at 100%/almost hangs the internet explorer window, and it doesn't work for me ?? My computer only or? Link to comment Share on other sites More sharing options...
Hasher Posted February 12, 2007 Author Share Posted February 12, 2007 Thanks Freefry I took the $oEvent = ObjEvent($oIE, "IEEvent_") out of the loop and used BeforeNavigate (which works for submit and navigating away from current page) and it works fine now.... new source is $oEvent = ObjEvent($oIE, "IEEvent_") While $i = 1 sleep(10) WEnd Your where very helpful :-) Thanks Paul Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of shhh extensions! Link to comment Share on other sites More sharing options...
FreeFry Posted February 12, 2007 Share Posted February 12, 2007 (edited) Great to be of help Though, all submits doesn't really "navigate", at least I don't think they do(take for example when submitting something that doesn't load/reload a page).But of course for finding when a page is updated it works great! Edit:Taken from MSND @ http://msdn.microsoft.com/workshop/browser...renavigate2.aspThe BeforeNavigate2 event replaces the BeforeNavigate and FrameBeforeNavigate events, which should no longer be used. The pDisp parameter that specifies the corresponding WebBrowser object clearly identifies where the navigation is to occur. Microsoft Internet Explorer 3.0 required the FrameBeforeNavigate and a target frame name to identify the target of navigation. However, this solution was potentially ambiguous as frame names are not unique. Edited February 12, 2007 by FreeFry 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