extra logging messages and code cleanup

main
Yuriy 2 years ago
parent d499568370
commit e7735c39c6

@ -97,92 +97,65 @@ CreateArrayOfChromeTabs() {
ChromeTabsURLArray := [] ChromeTabsURLArray := []
try TotalTabsFound := Driver.Windows.Count try TotalTabsFound := Driver.Windows.Count
; Message = TotalTabsFound: %TotalTabsFound%
; DevModeMsgBox(Message)
; DevModeMsgBox(TotalTabsFound)
/* ; if only 1 tab exists, grab info, push to array and return
if(TotalTabsFound = 1){
try Title := Driver.Title
try URL := Driver.URL
if(Title != "")
DriverTitleArray.Push(Title)
if(URL != "")
ChromeTabsURLArray.Push(URL)
return
}
*/ StartTime := A_TickCount
; Msgbox % "TotalTabsFound: " TotalTabsFound
; if(DevMode)
; Msgbox % "TotalTabsFound: " TotalTabsFound
; msgbox % "total Tabs:" Driver.Windows.Count
; Message = Creating an Array of Chrome Tabs
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; StartTime := A_TickCount
; Sleep, 1000
StartTime := A_TickCount
; 5 is arbitrary number to do some extra loops to make sure all tabs are gone through
; most likely not necessary because unloaded tabs cannot be activated
TotalTabLoops := TotalTabsFound + 5
; 5 is arbitrary number to do some extra loops to make sure all tabs are gone through Message = Total Pre-Existing Tabs in Chrome: %TotalTabsFound%`nTotal Times looping through tabs to create Chrome Tabs Array: %TotalTabLoops%
; most likely not necessary because unloaded tabs cannot be activated SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
TotalTabLoops := TotalTabsFound + 5
; Message = TotalTabLoops: %TotalTabLoops%
; DevModeMsgBox(message)
Message = Creating an Array of All Chrome Tabs`n(Sometimes might get stuck for a short while if there is something loading in a tab)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; TooltipThis(Message) Message = Creating an Array of All Chrome Tabs`n(Sometimes might get stuck for a short while if there is something loading in a tab)
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
Message = Total Times looping through tabs to create Chrome Tabs Array: %TotalTabLoops%
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
Loop % TotalTabLoops { Loop % TotalTabLoops {
try Title := Driver.Title try Title := Driver.Title
try URL := Driver.URL try URL := Driver.URL
if(Title != "") if(Title != "")
DriverTitleArray.Push(Title) DriverTitleArray.Push(Title)
if(URL != "") if(URL != "")
ChromeTabsURLArray.Push(URL) ChromeTabsURLArray.Push(URL)
; exit after looping through 1 tab, if only 1 tab found in count ; exit after looping through 1 tab, if only 1 tab found in count
if(TotalTabsFound = 1 AND A_index > TotalTabsFound){ if(TotalTabsFound = 1 AND A_index > TotalTabsFound){
Message = Exiting Early after 1 loop. Only 1 tab found Message = Exiting Early after 1 loop. Only 1 tab found
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox(message) ; DevModeMsgBox(message)
break break
} }
TabEndTime := A_TickCount - TabFoundStartTime TabEndTime := A_TickCount - TabFoundStartTime
TabEndTimeArray .= TabEndTime . "," TabEndTimeArray .= TabEndTime . ","
; Message = Time to switch to new tab: %TabEndTime%`nCurrent Loop: %A_index%/%TotalTabsFound% ; Message = Time to switch to new tab: %TabEndTime%`nCurrent Loop: %A_index%/%TotalTabsFound%
; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging") ; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
TabFoundStartTime := A_TickCount TabFoundStartTime := A_TickCount
; TimeToGrabCurrentTab := A_TickCount - StartTime ; TimeToGrabCurrentTab := A_TickCount - StartTime
; Msgbox % "TimeToGrabCurrentTab: " TimeToGrabCurrentTab ; Msgbox % "TimeToGrabCurrentTab: " TimeToGrabCurrentTab
; Stop page refresh if it's happening ; Stop page refresh if it's happening
; try driver.executeScript("return window.stop") ; try driver.executeScript("return window.stop")
; TimeToGrabCurrentTab := A_TickCount - StartTime ; TimeToGrabCurrentTab := A_TickCount - StartTime
; Msgbox % "TimeToGrabCurrentTab: " TimeToGrabCurrentTab ; Msgbox % "TimeToGrabCurrentTab: " TimeToGrabCurrentTab
; VAR := HasVal(ChromeTabsURLArray, STRINGVAR) ; returns position of value in array ; VAR := HasVal(ChromeTabsURLArray, STRINGVAR) ; returns position of value in array
/* /*
if(HasVal(ChromeTabsURLArray, URL)){ ; returns position of value in array if(HasVal(ChromeTabsURLArray, URL)){ ; returns position of value in array

Loading…
Cancel
Save