wb.busy not working

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Trigg
Posts: 97
Joined: 07 Apr 2017, 19:43

wb.busy not working

09 Jun 2017, 13:37

wb.Busy and ReadyState do not work 100% of the time with a website I'm using. Probably due to the interface or because I'm naming the ComObj as ICwb.

So I was wondering if there is a way I can loop a delay depending on if the style of the display is "none" or "block"?

I feel like I'm so close, but I can't figure it out :(

Code: Select all

ICwb.document.getelementbyID("LHS_actionsDiv").getElementsByTagName("a")[0].click()
; <div id="igLnFTemplate" class="igLnFTemplate" style="display: none"></div>
; <div id="lbOverlay" style="display: none;"></div> **** <- this is the background display (none / block)
Loop {
;Var := ICwb.document.getelementbyID("lbOverlay").innertext.value	; get the value
;Var := ICwb.document.getelementbyID("LHS_actionsDiv").getelementsbytagname("div").innertext
Msgbox %Var% 	; see if the value worked which it doesnt
IfInString, Var, block, break
}

Sleep, 500	; works, but is inconsistent

;While wb.readyState!=4 || wb.document.readyState!="complete"           failed attempt
;{
;Sleep,10
;if (A_index >= 200)
;Break
;}

;While wb.readyState!=4 || wb.document.readyState!="complete" || A_index <= 200         failed attempt
;Sleep,100

;ICwb.Busy         failed attempt
;wb.Busy         failed attempt
	;Sleep, 10
	;sleep, 200
	
ICwb.document.getelementbyID("igUserInteractResponseYes").Click()
User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: wb.busy not working

09 Jun 2017, 13:43

try waiting for busy true before waiting for busy false. Click doesn't always start navigation instantly
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
Trigg
Posts: 97
Joined: 07 Apr 2017, 19:43

Re: wb.busy not working

09 Jun 2017, 14:43

tank wrote:try waiting for busy true before waiting for busy false. Click doesn't always start navigation instantly
Hey that worked! Thanks!

Code: Select all

while ICwb.Busy
	Sleep, 10
while !ICwb.Busy
	Sleep, 10
One more thing, is there a way to loop through the HTML of a table or the webpage until you reach the innertext you want, but go up one?

I have a table where I'm looking at multiple coverages (cov A, B, C, etc) and I'm trying to look for "A&O". Depending on the claim A&O can be in one of any coverage. I want to get the innertext value of the "Coverage" part of the HTML. The Coverages are always in different places of the table so I can't always pull up the first Coverage ID.

Code: Select all

;<td name="COVERAGE" id="COVERAGE" align="center" class="colCOVERAGE">Covg A</td>		; multiple of these in a table
;<td name="RESERVETYPE" id="RESERVETYPE" align="center" class="colRESERVETYPE">Expense - A&O</td>	; looking for this but want to copy inner text of the html above this.



AO := ""

While ( AO <> "Expense - A&O" )
       ; Loops through the elements, until its innerText matches.
AO := ICwb.document.getElementsByTagName( "td")[ A_Index - 1].innerText
;Coverage := ?

User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: wb.busy not working

09 Jun 2017, 16:16

So what a_index-2?
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
Trigg
Posts: 97
Joined: 07 Apr 2017, 19:43

Re: wb.busy not working

12 Jun 2017, 15:27

tank wrote:So what a_index-2?
Kinda. But I'm looking for the inner text of the table before the A&O. I'm trying to find the accurate Coverage of what the A&O reserves are in that table. Sometimes A&O can be under Cov B, C, D, etc.

Table example:
Cov A :::::: DCC Reserves :::::: Amount
Cov C :::::: Loss Reserves :::::: Amount
Cov A :::::: A&O Reserves :::::: Amount
Cov A :::::: Loss Reserves :::::: Amount


I was thinking of A_Index, but it won't go to the Coverage I want, right?
User avatar
tank
Posts: 3122
Joined: 28 Sep 2013, 22:15
Location: CarrolltonTX
Contact:

Re: wb.busy not working

12 Jun 2017, 15:42

if you found A&O and the previous TD has the coverage your looking for then use a_index-2
you're in td a_index-1 which in this example probably indicates a_index = 2 you want td 0 the very first one. so a_index-2 gets you there
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
Telegram is the best way to reach me
https://t.me/ttnnkkrr
If you have forum suggestions please submit a
Check Out WebWriter
Trigg
Posts: 97
Joined: 07 Apr 2017, 19:43

Re: wb.busy not working

13 Jun 2017, 10:02

tank wrote:if you found A&O and the previous TD has the coverage your looking for then use a_index-2
you're in td a_index-1 which in this example probably indicates a_index = 2 you want td 0 the very first one. so a_index-2 gets you there
So something like this?

Code: Select all

While ( AO <> "Expense - A&O" )
       ; Loops through the elements, until its innerText matches.
AO := ICwb.document.getElementsByTagName("td")[ A_Index -1].innertext, index := A_Index -2
Coverage := ICwb.document.getElementsByTagName("td")[ index].innertext

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, Google [Bot], LRRUNB, OrangeCat and 157 guests