extra logging messages and code cleanup

This commit is contained in:
2023-03-04 00:13:31 -05:00
parent d499568370
commit e7735c39c6

View File

@@ -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 StartTime := A_TickCount
if(TotalTabsFound = 1){
try Title := Driver.Title
try URL := Driver.URL
if(Title != "")
DriverTitleArray.Push(Title)
if(URL != "")
ChromeTabsURLArray.Push(URL)
return
}
*/
; 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 ; 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 ; most likely not necessary because unloaded tabs cannot be activated
TotalTabLoops := TotalTabsFound + 5 TotalTabLoops := TotalTabsFound + 5
; Message = TotalTabLoops: %TotalTabLoops%
; DevModeMsgBox(message)
Message = Total Pre-Existing Tabs in Chrome: %TotalTabsFound%`nTotal Times looping through tabs to create Chrome Tabs Array: %TotalTabLoops%
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,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; TooltipThis(Message)
Message = Total Times looping through tabs to create Chrome Tabs Array: %TotalTabLoops%
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
Loop % TotalTabLoops {
try Title := Driver.Title
try URL := Driver.URL
if(Title != "")
DriverTitleArray.Push(Title)
if(URL != "")
ChromeTabsURLArray.Push(URL)
; exit after looping through 1 tab, if only 1 tab found in count
if(TotalTabsFound = 1 AND A_index > TotalTabsFound){
Message = Exiting Early after 1 loop. Only 1 tab found
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox(message)
break
}
TabEndTime := A_TickCount - TabFoundStartTime
TabEndTimeArray .= TabEndTime . ","
; Message = Time to switch to new tab: %TabEndTime%`nCurrent Loop: %A_index%/%TotalTabsFound%
; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
TabFoundStartTime := A_TickCount
; TimeToGrabCurrentTab := A_TickCount - StartTime
; Msgbox % "TimeToGrabCurrentTab: " TimeToGrabCurrentTab
; Stop page refresh if it's happening
; try driver.executeScript("return window.stop")
; TimeToGrabCurrentTab := A_TickCount - StartTime 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)
; Msgbox % "TimeToGrabCurrentTab: " TimeToGrabCurrentTab SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
; VAR := HasVal(ChromeTabsURLArray, STRINGVAR) ; returns position of value in array
Loop % TotalTabLoops {
try Title := Driver.Title
try URL := Driver.URL
if(Title != "")
DriverTitleArray.Push(Title)
if(URL != "")
ChromeTabsURLArray.Push(URL)
; exit after looping through 1 tab, if only 1 tab found in count
if(TotalTabsFound = 1 AND A_index > TotalTabsFound){
Message = Exiting Early after 1 loop. Only 1 tab found
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox(message)
break
}
TabEndTime := A_TickCount - TabFoundStartTime
TabEndTimeArray .= TabEndTime . ","
; Message = Time to switch to new tab: %TabEndTime%`nCurrent Loop: %A_index%/%TotalTabsFound%
; SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
TabFoundStartTime := A_TickCount
; TimeToGrabCurrentTab := A_TickCount - StartTime
; Msgbox % "TimeToGrabCurrentTab: " TimeToGrabCurrentTab
; Stop page refresh if it's happening
; try driver.executeScript("return window.stop")
; TimeToGrabCurrentTab := A_TickCount - StartTime
; Msgbox % "TimeToGrabCurrentTab: " TimeToGrabCurrentTab
; 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