kalel69 Posted August 25, 2012 Posted August 25, 2012 I asked this question in another post, but everyone ignored it, so I will ask it here in a new post... sorry for the redundency... I have a web page that is slow to load at times, and I work in frames. I've tried _LoadWait, but it returns before all the frames load, and the objects don't get created because it can't find the paths to the objects within the frames. If I put just sleep commands in it works but takes too long. I'd like it to return to the user after the page loads 100 % completely and my commands don't fail. I've been doing it by checking isobj() $Count = 0 Do $Count+=1 $oIE = _IEAttachHDL($DQMwHndl) Sleep(200) If $Count > 10 Then MsgBox(0,$DQMerror1,$DQMerror2) Return EndIf Until IsObj($oIE) This works, but takes up CPU time checking a lot until the page loads. ($DQMwHndl is the handle to the IECREATE(web address) - _IEAttachHDL is a shorned version only using HWND's) After the attach, I have to check for the frame, and form, using the same logic, or sometimes my script fails, as it cant get past all that stuff. The short version: $oIE = _IEAttachHDL($DQMwHndl) $oIFrame = _IEFrameGetObjByName($oIE, "ifmPage") $oForm = _IEFormGetObjByName($oIFrame, "frmADT") $oSubmit = _IEGetObjByName($oForm, "button2") $oSearchCompID = _IEFormElementGetObjByName($oForm, $CompanyPicker) _IEFormElementSetValue($oSearchCompID,$ClientFacility) _IEAction($oSubmit, "click") the long version is what works, with each line above having a loop to check IsObj(). Basically because _loadwait() really doesn't work well. So each time I click a link, i have to verify all the objects again. expandcollapse popupFunc _ADTDefs() If WinExists($DQMwHndl) Then $oIE = _IEAttachHDL($DQMwHndl) _IELinkClickByIndex ($oIE, $ClickADTDefSearch);link 43 search ADT defs. Sleep(200) $Count = 0 Do $Count+=1 $oIE = _IEAttachHDL($DQMwHndl) Sleep(200) If $Count > 10 Then MsgBox(0,$DQMerror1,$DQMerror2) Return EndIf Until IsObj($oIE) Sleep(200) $Count = 0 Do $Count+=1 $oIFrame = _IEFrameGetObjByName($oIE, "ifmPage") Sleep(200) If $Count > 10 Then MsgBox(0,$DQMerror1,$DQMerror2) Return EndIf Until IsObj($oIFrame) Sleep(200) $Count = 0 Do $Count+=1 $oForm = _IEFormGetObjByName($oIFrame, "frmADT") Sleep(200) If $Count > 10 Then MsgBox(0,$DQMerror1,$DQMerror2) Return EndIf Until IsObj($oForm) Sleep(200) $Count = 0 Do $Count+=1 $oSubmit = _IEGetObjByName($oForm, "button2") Sleep(200) If $Count > 10 Then MsgBox(0,$DQMerror1,$DQMerror2) Return EndIf Until IsObj($oSubmit) Sleep(300) $Count = 0 Do $Count+=1 $oSearchCompID = _IEFormElementGetObjByName($oForm, $CompanyPicker);this is the call that is failing... if @error then $Temp = 0;nothing Sleep(400) If $Count > 10 Then MsgBox(0,$DQMerror1,$DQMerror2) Return EndIf Until IsObj($oSearchCompID) Sleep(400) _IEFormElementSetValue($oSearchCompID,$ClientFacility) Sleep(500) _IEAction($oSubmit, "click") EndIf EndFunc Is there a better way to make sure each object is a valid object other than what I preset here (too lengthy-not a clean script, too much CPU time) or a better way to ensure the page is really loaded instead of relying on LoadWait that will allow the short version to run properly? Thanks in Advance!
water Posted August 25, 2012 Posted August 25, 2012 I asked this question in another post, but everyone ignored it, so I will ask it here in a new post...Do you think opening a second thread on the same subject is a good idea?This is no 24 hours support forum. If you don't get the replies you are waiting for, accept it.There many threads without any reply. You got many, but obviously not the solution you are waiting for. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
kalel69 Posted August 25, 2012 Author Posted August 25, 2012 Water, are you in a bad mood today?Why are you totally dis'sing my post without knowing the facts about it?YOU are the one who totally ignored my previous post. It twas not a topic I created, rather than a reply under someone else post. I started by saying it was "a bit off topic but similiar", and NO ONE offered a peice of advice for me, rather just went on about that topic. check out this...I am not asking for immediate repsonse, rather a newbie poster (9 posts here), and this is how you treat the newbies?I don't want to start a flame war, i'm simply lookilng for help, and maybe the first place I posted this was the wrong place. So I posted it here instead. Thanks for understanding. But no thank you for the help.Can someone ELSE please look at this?
water Posted August 25, 2012 Posted August 25, 2012 Not in bad mood but it seems I need glasses I was under the impression that the OP of the thread I referred to started a new one with the same content.That's what happens when you "hijack" a thread. You should have opened a new one in the first place The only help I can offer at the moment is:Do not wait for the IE object to load but for a DOM element in your frames. The help file gives a bit more detail about this. boomingranny 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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