Added functions from Social Media Poster Shared Functions file so SharedFunctions.ahk can be replaced by this submodule
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "Lib/Freedomain-Posters-Shared-Functions"]
|
||||
path = Lib/Freedomain-Posters-Shared-Functions
|
||||
url = https://git.freedomainplaylists.com/yuriy/Freedomain-Posters-Shared-Functions.git
|
||||
1
Lib/Freedomain-Posters-Shared-Functions
Submodule
1
Lib/Freedomain-Posters-Shared-Functions
Submodule
Submodule Lib/Freedomain-Posters-Shared-Functions added at 694c440a6a
@@ -15,6 +15,7 @@ global CurrentTabURL
|
||||
; #Include %A_ScriptDir%\RunCMD.ahk
|
||||
|
||||
|
||||
; @todo: add error checks for all winhttp requests.
|
||||
|
||||
|
||||
DevModeMsgBox(Message){
|
||||
@@ -26,7 +27,7 @@ DevModeMsgBox(Message){
|
||||
}
|
||||
|
||||
|
||||
CheckForUpdates(){
|
||||
CheckForUpdates(GitReleasesAPIURL){
|
||||
; msgbox, checking for updates
|
||||
Message = Checking For Updates
|
||||
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile")
|
||||
@@ -174,6 +175,7 @@ TakeScreenshotOfPage(SaveFilepath := ""){
|
||||
|
||||
; -------------------------------TooltipThis-------------------------------
|
||||
TooltipThis(String){
|
||||
; msgbox
|
||||
; Xposition := StrLen(String)
|
||||
StringFirstLine := StrSplit(String, "`n")
|
||||
StringFirstLine := StringFirstLine[1]
|
||||
@@ -922,7 +924,9 @@ if(TotalTabsFound = 1){
|
||||
; / END OF FUNC
|
||||
}
|
||||
|
||||
InputFilePathIntoOpenWindow(Filepath){
|
||||
/*
|
||||
*/
|
||||
InputFilePathIntoOpenWindow(Filepath){
|
||||
; Msgbox % "Filepath: " Filepath
|
||||
Message = Waiting for "Open" window to appear to input filepath into
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
@@ -946,9 +950,9 @@ if(TotalTabsFound = 1){
|
||||
if(OpenWindowExist)
|
||||
ControlSend, Edit1, {Enter}, Open
|
||||
ToolTip,
|
||||
}
|
||||
}
|
||||
|
||||
CheckCurrentTabForCurrentSite(){
|
||||
CheckCurrentTabForCurrentSite(){
|
||||
try CurrentTabURL := driver.url
|
||||
|
||||
if(!InStr(CurrentTabURL, CurrentSite)){
|
||||
@@ -962,11 +966,11 @@ if(TotalTabsFound = 1){
|
||||
|
||||
; msgbox % InStr(CurrentTabURL,CurrentSite)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; -------------------------------NavigateFromBaseURLTo-------------------------------
|
||||
NavigateFromBaseURLTo(URL){
|
||||
; -------------------------------NavigateFromBaseURLTo-------------------------------
|
||||
NavigateFromBaseURLTo(URL, Title:="REmoveMe"){
|
||||
if(!DriverStatus){ ; if not connected to selenium chrome, then re-connect
|
||||
Status := CheckSeleniumDriver()
|
||||
if(Status)
|
||||
@@ -981,11 +985,11 @@ if(TotalTabsFound = 1){
|
||||
URLBase := StrSplit(URLBase, "/")
|
||||
URLBase := URLBase[1]
|
||||
URLBase := StrReplace(URLBase, "www.","")
|
||||
}
|
||||
}
|
||||
|
||||
; if base url is not in tab array, create new tab and push url to array
|
||||
if(!HasSubstringVal(DriverURLArray, URLBase))
|
||||
{
|
||||
; if base url is not in tab array, create new tab and push url to array
|
||||
if(!HasSubstringVal(DriverURLArray, URLBase))
|
||||
{
|
||||
try CurrentTabTitle := driver.window.title
|
||||
|
||||
; if currently in new tab navigate to the site in the current tab
|
||||
@@ -1013,17 +1017,17 @@ if(TotalTabsFound = 1){
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Message = Finding Tab
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
Message = Finding Tab
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
TabFoundSuccessfully :=
|
||||
TabFoundSuccessfully :=
|
||||
|
||||
NumberOfTabLoops := DriverURLArray.Length()
|
||||
NumberOfTabLoops := DriverURLArray.Length()
|
||||
|
||||
; loop through tabs to find matching tab
|
||||
loop % NumberOfTabLoops {
|
||||
; loop through tabs to find matching tab
|
||||
loop % NumberOfTabLoops {
|
||||
try driver.SwitchToNextWindow()
|
||||
|
||||
; sleep, 1000
|
||||
@@ -1044,10 +1048,10 @@ if(TotalTabsFound = 1){
|
||||
|
||||
; try driver.SwitchToNextWindow
|
||||
Continue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(InStr(CurrentTabURL, URLBase)){
|
||||
if(InStr(CurrentTabURL, URLBase)){
|
||||
Message = CurrentTabURL is %CurrentTabURL% and it contains %URLBase%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
||||
|
||||
@@ -1057,20 +1061,20 @@ if(TotalTabsFound = 1){
|
||||
; DevModeMsgBox(message)
|
||||
; msgbox %CurrentTabURL% = %URL%
|
||||
Break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
; if failed to switch to tab and a new tab was not created, then chrome failed to switch to the tab
|
||||
; this happens sometimes. most likely to a chromedriver bug or maybe tab being offloaded?
|
||||
if(!TabFoundSuccessfully AND !NewTabCreated){
|
||||
; if failed to switch to tab and a new tab was not created, then chrome failed to switch to the tab
|
||||
; this happens sometimes. most likely to a chromedriver bug or maybe tab being offloaded?
|
||||
if(!TabFoundSuccessfully AND !NewTabCreated){
|
||||
; @todo : not sure how to best solve this problem currently. It doesn't happen very often.
|
||||
; last time it happened was when there were only 2 chrome tabs open, gab + subscribestar. chrome was stuck on subscribestar page and wouldn't nextwindow() to gab
|
||||
}
|
||||
}
|
||||
|
||||
; Message = TabFoundSuccessfully: %TabFoundSuccessfully%
|
||||
; DevModeMsgBox(Message)
|
||||
; Message = TabFoundSuccessfully: %TabFoundSuccessfully%
|
||||
; DevModeMsgBox(Message)
|
||||
|
||||
if(!NewTabCreated){ ; if re-using a tab then we want to re-navigate to URL because it might be the wrong page
|
||||
if(!NewTabCreated){ ; if re-using a tab then we want to re-navigate to URL because it might be the wrong page
|
||||
try driver.Get(URL) ;Open selected URL
|
||||
try driver.executeScript("return document.readyState").equals("complete") ; wait until page loads completely before proceeding
|
||||
catch e {
|
||||
@@ -1083,12 +1087,12 @@ if(TotalTabsFound = 1){
|
||||
Return "Failed"
|
||||
}
|
||||
}
|
||||
}
|
||||
; msgbox, no error caught
|
||||
; }
|
||||
}
|
||||
; msgbox, no error caught
|
||||
; }
|
||||
|
||||
|
||||
Return
|
||||
Return
|
||||
}
|
||||
; End of Function
|
||||
; -------------------------------/NavigateFromBaseURL-------------------------------
|
||||
|
||||
Reference in New Issue
Block a user