formatting updates

main
Yuriy 2 years ago
parent de5b8afdf0
commit 2286c13ceb

@ -14,8 +14,7 @@ global CurrentTabURL
; #Include %A_ScriptDir%\ChromeAutomationFunctions.ahk ; #Include %A_ScriptDir%\ChromeAutomationFunctions.ahk
; #Include %A_ScriptDir%\RunCMD.ahk ; #Include %A_ScriptDir%\RunCMD.ahk
#Include C:\Users\%A_username%\Syncthing\Freedomain\Uploaders\Lib\ChromeAutomationFunctions.ahk
#Include C:\Users\%A_username%\Syncthing\Freedomain\Uploaders\Lib\RunCMD.ahk
DevModeMsgBox(Message){ DevModeMsgBox(Message){
@ -35,8 +34,6 @@ CheckForUpdates(){
data := URLDownloadToVar(GitReleasesAPIURL) data := URLDownloadToVar(GitReleasesAPIURL)
; Msgbox % "data: " data ; Msgbox % "data: " data
; [{"id":3,"tag_name":"v2.71","target_commitish":"main","name":"2.71","body":"- Fixed and expanded Parler login check\r\n- Fixed long time bug where a newly created website tab would not get connected to properly\r\n- Temporarily removed Auto Update Support until I can integrate with gitea API","url":"https://git.zinchuk.xyz/api/v1/repos/yuriy/Freedomain_Social_Media_Poster/releases/3","html_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/releases/tag/v2.71","tarball_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/archive/v2.71.tar.gz","zipball_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/archive/v2.71.zip","draft":false,"prerelease":true,"created_at":"2023-01-26T23:45:25-05:00","published_at":"2023-01-26T23:45:25-05:00","author":{"id":1,"login":"yuriy","login_name":"","full_name":"Yuriy Zinchuk","email":"yuriy@noreply.localhost","avatar_url":"https://secure.gravatar.com/avatar/82acf184352c9232da15222248417df0?d=identicon","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2023-01-02T16:40:09-05:00","restricted":false,"active":false,"prohibit_login":false,"location":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"yuriy"},"assets":[{"id":4,"name":"Freedomain Social Media Poster.exe","size":1708544,"download_count":0,"created_at":"2023-01-26T23:45:19-05:00","uuid":"2ee05d49-a314-4079-bcc8-b6857dc29e98","browser_download_url":"https://git.zinchuk.xyz/attachments/2ee05d49-a314-4079-bcc8-b6857dc29e98"}]},{"id":2,"tag_name":"v2.70","target_commitish":"main","name":"2.70","body":"* Initial commit of V2.7 to git\r\n* Pushed codebase to personal [git instance](https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/)\r\n* Fixed Locals Posting\r\n* Fixed Gettr Posting\r\n* Fixed Flote Posting\r\n* Fixed MeWe Posting\r\n* Fixed Minds Posting\r\n* Fixed Steemit Posting\r\n* Fixed LinkedIn Image Posting\r\n* Removed Tumblr Support\r\n* Removed Pintrest support","url":"https://git.zinchuk.xyz/api/v1/repos/yuriy/Freedomain_Social_Media_Poster/releases/2","html_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/releases/tag/v2.70","tarball_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/archive/v2.70.tar.gz","zipball_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/archive/v2.70.zip","draft":false,"prerelease":true,"created_at":"2023-01-25T22:38:24-05:00","published_at":"2023-01-25T22:38:24-05:00","author":{"id":1,"login":"yuriy","login_name":"","full_name":"Yuriy Zinchuk","email":"yuriy@noreply.localhost","avatar_url":"https://secure.gravatar.com/avatar/82acf184352c9232da15222248417df0?d=identicon","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2023-01-02T16:40:09-05:00","restricted":false,"active":false,"prohibit_login":false,"location":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"yuriy"},"assets":[{"id":2,"name":"Freedomain Social Media Poster.exe","size":1707520,"download_count":1,"created_at":"2023-01-25T22:36:17-05:00","uuid":"d91a4ab0-b1fb-4c2f-adfa-e986e587cf0a","browser_download_url":"https://git.zinchuk.xyz/attachments/d91a4ab0-b1fb-4c2f-adfa-e986e587cf0a"}]}]
parsed := JSON.Load(data) parsed := JSON.Load(data)
UpdateVersionNumber := parsed.1.name UpdateVersionNumber := parsed.1.name
@ -58,8 +55,6 @@ CheckForUpdates(){
} }
UpdateScript(){ UpdateScript(){
data := URLDownloadToVar(GitReleasesAPIURL) data := URLDownloadToVar(GitReleasesAPIURL)
@ -95,21 +90,22 @@ UpdateScript(){
IfMsgBox Yes, { IfMsgBox Yes, {
Return Return
} Else IfMsgBox No, { }
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging") Else IfMsgBox No, {
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
; Msgbox, downloading to: %A_ScriptDir%\%UpdateExeName% ; Msgbox, downloading to: %A_ScriptDir%\%UpdateExeName%
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath% UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%" run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
ExitApp ExitApp
} }
return return
} }
; -------------------------------SaveOrPostProgress------------------------------- ; -------------------------------SaveOrPostProgress-------------------------------
; PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging,DiscordVideos" ; PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging,DiscordVideos"
SaveOrPostProgress(Message:="",PostType:=""){ SaveOrPostProgress(Message:="",PostType:=""){
MessageBU := Message MessageBU := Message
; Msgbox % "PostType: " PostType ; Msgbox % "PostType: " PostType
@ -141,9 +137,9 @@ UpdateScript(){
} }
; -------------------------------/SaveOrPostProgress------------------------------- ; -------------------------------/SaveOrPostProgress-------------------------------
TakeScreenshotOfPage(SaveFilepath := ""){ TakeScreenshotOfPage(SaveFilepath := ""){
if(!ScreenshotResult) if(!ScreenshotResult)
return return
@ -158,9 +154,9 @@ UpdateScript(){
; if(!FileExist(SaveFilepath)) ; if(!FileExist(SaveFilepath))
FileCreateDir, %SaveFilepath% FileCreateDir, %SaveFilepath%
/* if(!TakeScreenshotsOfErrors) if(!TakeScreenshotsOfErrors)
Return Return
*/
; Take a screenshot of the page and save it. ; Take a screenshot of the page and save it.
FormatTime, TodayDate , YYYYMMDDHH24MISS, yyyyMMdd_hhmmss FormatTime, TodayDate , YYYYMMDDHH24MISS, yyyyMMdd_hhmmss
@ -896,11 +892,13 @@ if(TotalTabsFound = 1){
; Msgbox % "A_index: " A_index ; Msgbox % "A_index: " A_index
; DevModeMsgBox("breaking early on loop 1?") ; DevModeMsgBox("breaking early on loop 1?")
break break
} ; if there is only 1 tab, then break out of loop and don't bother looping through same tab ; if there is only 1 tab, then break out of loop and don't bother looping through same tab
}
*/ */
try driver.SwitchToNextWindow ;Focuses Selenium on the newly opened/next window. try driver.SwitchToNextWindow ;Focuses Selenium on the newly opened/next window.
} ; end of loop ; end of loop
}
; Iterate from 1 to the end of the array: ; Iterate from 1 to the end of the array:
Loop % DriverURLArray.Length() Loop % DriverURLArray.Length()
@ -917,7 +915,8 @@ if(TotalTabsFound = 1){
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging") SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
; DevModeMsgBox(Message) ; DevModeMsgBox(Message)
return return
} ; /FUNC ; / END OF FUNC
}
InputFilePathIntoOpenWindow(Filepath){ InputFilePathIntoOpenWindow(Filepath){
; Msgbox % "Filepath: " Filepath ; Msgbox % "Filepath: " Filepath
@ -1030,17 +1029,17 @@ if(TotalTabsFound = 1){
Return Return
} }
; End of Function ; End of Function
; -------------------------------/NavigateFromBaseURL------------------------------- ; -------------------------------/NavigateFromBaseURL-------------------------------
SaveDriverURL(){ ; save the url of the result page. That way if a tab is not found for a site, we can open up a tab from this tab instead of middle of nowhere. That way we can keep the tabs together SaveDriverURL(){ ; save the url of the result page. That way if a tab is not found for a site, we can open up a tab from this tab instead of middle of nowhere. That way we can keep the tabs together
try LastWebsitePostURL := driver.URL try LastWebsitePostURL := driver.URL
} }
; -------------------------------SChrome_Get------------------------------- ; -------------------------------SChrome_Get-------------------------------
SChrome_Get(URL := "", Profile := "Profile 1", IP_Port := "127.0.0.1:9222"){ SChrome_Get(URL := "", Profile := "Profile 1", IP_Port := "127.0.0.1:9222"){
IP_Port_Nr := RegExReplace(IP_Port, ".*:(\d*)", "$1") IP_Port_Nr := RegExReplace(IP_Port, ".*:(\d*)", "$1")
if WinExist("ahk_exe Chrome.exe"){ if WinExist("ahk_exe Chrome.exe"){
WinGet, pid, PID, ahk_exe chrome.exe WinGet, pid, PID, ahk_exe chrome.exe
@ -1070,9 +1069,6 @@ if(TotalTabsFound = 1){
} }
} }
; ; yuriy's settings
; IniRead, ChromeFilepath, C:\Users\%A_username%\Documents\Autohotkey\Lib\ScriptSettings.ini, Selenium, %A_Computername%, %A_Space%
; ; Establish Variable with Filepath to be used throughout the script ; ; Establish Variable with Filepath to be used throughout the script
; if(ChromeFilepath = ""){ ; if(ChromeFilepath = ""){
if(FileExist("C:\Program Files\Google\Chrome\Application\chrome.exe")){ if(FileExist("C:\Program Files\Google\Chrome\Application\chrome.exe")){

@ -33,7 +33,7 @@ Automated posting to the following social media platforms, utilizing either the
- Open Chrome and type in `about::version` into the URL bar. The very first line will tell you what Chrome version you have - Open Chrome and type in `about::version` into the URL bar. The very first line will tell you what Chrome version you have
- After downloading, extract “chromedriver_win32.zip” and move the extracted chromedriver.exe to: `C:\Program Files\SeleniumBasic\chromedriver.exe` - After downloading, extract “chromedriver_win32.zip” and move the extracted chromedriver.exe to: `C:\Program Files\SeleniumBasic\chromedriver.exe`
- NOTE: The chromedriver will need to be re-downloaded whenever Chrome updates to keep up with API changes - NOTE: The chromedriver will need to be re-downloaded whenever Chrome updates to keep up with API changes
4. [Download the latest .exe of the Poster] (https://git.zinchuk.xyz/yuriy/Freedomain-Social-Media-Poster/releases) 4. [Download the latest .exe of the Poster](https://git.zinchuk.xyz/yuriy/Freedomain-Social-Media-Poster/releases)
- When run, the poster will automatically create the folders and files it requires in the directory it's run from. - When run, the poster will automatically create the folders and files it requires in the directory it's run from.
# Settings.ini # Settings.ini
@ -57,3 +57,6 @@ TelegramBotChatID=Public Posts Bot Chat ID
Ive done my best to catch any possible errors that might pop up and write functionality to handle them. But If an error happens that i haven't written resolves for, it will pop up a message box that looks like this. Please send me a screenshot so I can write a patch for the bug. Ive done my best to catch any possible errors that might pop up and write functionality to handle them. But If an error happens that i haven't written resolves for, it will pop up a message box that looks like this. Please send me a screenshot so I can write a patch for the bug.
![Alt text](Assets/Screenshots/Error_Message_Example.png "Error Message") ![Alt text](Assets/Screenshots/Error_Message_Example.png "Error Message")
# Compiling .exe from source
- @todo
Loading…
Cancel
Save