Compare commits
19 Commits
8395c5c367
...
62e8afebb8
| Author | SHA1 | Date | |
|---|---|---|---|
| 62e8afebb8 | |||
| e654611bf3 | |||
| 6bf72336d0 | |||
| fd6be690da | |||
| a3d89a9892 | |||
| a5bc6225b6 | |||
| 4ac3c76641 | |||
| 96a8fb9566 | |||
| cf56ae8136 | |||
| 738e1af443 | |||
| f71def4542 | |||
| 20c2f44b0c | |||
| 997ee862ed | |||
| b378de8106 | |||
| ed307493b8 | |||
| 2860e4868f | |||
| 0e02ae24bd | |||
| b19482e10d | |||
| d7d3ce039f |
@@ -117,7 +117,7 @@ SendTelegramMessage(token, chatID, text := "", ParseMode := "MarkdownV2")
|
||||
json_resp := whr.ResponseText
|
||||
whr := ; free COM object
|
||||
; Msgbox % "json_resp: " json_resp
|
||||
if(InStr(json_resp, "error_code"))
|
||||
; if(InStr(json_resp, "error_code"))
|
||||
Return json_resp
|
||||
}
|
||||
|
||||
|
||||
BIN
Assets/Icon.png
Normal file
BIN
Assets/Icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
Assets/Icon.xcf
Normal file
BIN
Assets/Icon.xcf
Normal file
Binary file not shown.
BIN
Assets/Share.png
Normal file
BIN
Assets/Share.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -128,6 +128,7 @@ DownloadLatestChromium(){
|
||||
IfMsgBox OK, {
|
||||
|
||||
} Else IfMsgBox Cancel, {
|
||||
ToolTip
|
||||
return
|
||||
}
|
||||
|
||||
@@ -153,6 +154,7 @@ DownloadLatestChromium(){
|
||||
|
||||
Process, Close, chromedriver.exe
|
||||
sleep, 5000 ; wait 5 seconds before checking again
|
||||
continue
|
||||
}
|
||||
else,
|
||||
break
|
||||
@@ -309,13 +311,16 @@ DownloadLatestChromium(){
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
MsgBox 0x40,, %Message%
|
||||
|
||||
ChromeFilepath := ; clear out chromefilepath variable in case the path changed
|
||||
|
||||
ToolTip
|
||||
return
|
||||
}
|
||||
/*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
CheckForChromeUpdates(ChromeFilepath := ""){
|
||||
CheckForChromeUpdates(ChromeFilepath := ""){
|
||||
if(ChromeFilepath = "")
|
||||
ChromeFilepath := GetInstalledChromeFilepath()
|
||||
|
||||
@@ -329,12 +334,11 @@ DownloadLatestChromium(){
|
||||
else, Return 0
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GetInstalledChromeFilepath(){
|
||||
GetInstalledChromeFilepath(){
|
||||
; ChromeFilepath is global variable
|
||||
|
||||
if(ChromeFilepath = ""){
|
||||
|
||||
ChromePortableFilepath = %A_ScriptDir%\Lib\chrome-win64\chrome.exe
|
||||
@@ -351,22 +355,14 @@ DownloadLatestChromium(){
|
||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
}
|
||||
else {
|
||||
MsgBox 0x10, Chromium Portable not Found, Chromium Portable not found. `nPlease make sure it's located at one of the following paths and then try again.`n`n%ChromePortableFilepath% `nOR`n%ChromePortableFilepath2%
|
||||
|
||||
|
||||
; Leave this in for now, but i don't think we will be going to using the system Chrome in the future.
|
||||
; if(FileExist("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"))
|
||||
; ChromeFilepath = C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
|
||||
|
||||
; if(FileExist("C:\Program Files\Google\Chrome\Application\chrome.exe"))
|
||||
; ChromeFilepath = C:\Program Files\Google\Chrome\Application\chrome.exe
|
||||
MsgBox 0x10, Chrome Not Found, Chrome for Testing not found.`nIf this is your first time running on this computer, please click the "Chrome Up-To-Date" button to download the latest chrome binaries.
|
||||
}
|
||||
}
|
||||
ToolTip
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
GetInstalledChromeVersion(){
|
||||
GetInstalledChromeVersion(){
|
||||
|
||||
if(ChromeFilepath = ""){
|
||||
GetInstalledChromeFilepath()
|
||||
@@ -379,10 +375,10 @@ DownloadLatestChromium(){
|
||||
InstalledChromeVersion := StrReplace(InstalledChromeVersion, "`r") ; replace any newline characters that powershell returns
|
||||
|
||||
return InstalledChromeVersion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GetLatestChromeStableVersion(){
|
||||
GetLatestChromeStableVersion(){
|
||||
|
||||
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
||||
json_str := urldownloadtovar("https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json")
|
||||
@@ -399,10 +395,10 @@ DownloadLatestChromium(){
|
||||
}
|
||||
|
||||
return ChromeStableLatestVersion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GetDownloadURLOfChromeAndDriver(InstalledChromeVersion){
|
||||
GetDownloadURLOfChromeAndDriver(InstalledChromeVersion){
|
||||
; Will return the download URL of Chrome for Testing and Chrome Driver, seperated by a ||
|
||||
|
||||
; https://github.com/GoogleChromeLabs/chrome-for-testing#json-api-endpoints
|
||||
@@ -449,4 +445,4 @@ DownloadLatestChromium(){
|
||||
|
||||
URLS = %chromeDLURL64%||%chromedriverDLURL64%
|
||||
return URLS
|
||||
}
|
||||
}
|
||||
@@ -137,6 +137,10 @@ CheckDirExistAndCreate(Path){
|
||||
; -------------------------------/CheckDirExistAndCreate-------------------------------
|
||||
|
||||
|
||||
; Script Updates
|
||||
; ------------------------------------------------
|
||||
|
||||
|
||||
|
||||
CheckIfUpdateAvailable(Filepath, CurrentVersion){
|
||||
FileRead, ScriptUpdateContents, %Filepath%
|
||||
@@ -601,10 +605,53 @@ GetDateOrdinalSuffix(D) {
|
||||
}
|
||||
|
||||
|
||||
; Calculate the aspect ratio of a video/image using the width + height
|
||||
getAspectRatio(width, height) {
|
||||
gcd := gcdFunc(width, height)
|
||||
return round(width/gcd) ":" round(height/gcd)
|
||||
}
|
||||
|
||||
; The gcdFunc() is a helper function that calculates the GCD (greatest common divisor) of two numbers using the Euclidean algorithm.
|
||||
; Used for calculating aspect ratio of Videos
|
||||
gcdFunc(a, b) {
|
||||
while b
|
||||
t := b, b := Mod(a, b), a := t
|
||||
return a
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
; OnMsgbox - Custom Msgbox Screens
|
||||
;------------------------------------------------
|
||||
|
||||
ConfirmBeforeSubmitMsgboxFunc(){
|
||||
/*
|
||||
; Snippet to for check:
|
||||
if (ConfirmBeforeSubmit && ConfirmBeforeSubmitMsgboxFunc() != true) {
|
||||
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
|
||||
SaveOrPostProgress(Message:=Message, PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
return
|
||||
}
|
||||
*/
|
||||
OnMessage(0x44, "OnMsgBoxUserConfirmation")
|
||||
MsgBox 0x21, User Confirmation, Please check that all data was input correctly and fix any mistakes and then click PROCEED to finalize the Upload.`n`nClick STOP to cancel the rest of this Upload and move on to the next website.
|
||||
OnMessage(0x44, "")
|
||||
IfMsgBox OK, {
|
||||
return true
|
||||
} Else IfMsgBox Cancel, {
|
||||
Message = User Selected STOP button when asked for confirmation. Cancelling Rest of Site Upload.
|
||||
Return %Message%
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
OnMsgBoxUpdateAvailable() {
|
||||
DetectHiddenWindows, On
|
||||
Process, Exist
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
; GITEA Functions
|
||||
;------------------------------------------------
|
||||
CheckForUpdates(GitReleasesAPIURL){
|
||||
; msgbox, checking for updates
|
||||
Message = Checking For Updates
|
||||
CheckForUpdates(GitReleasesAPIURL, CurrentVersionNumber := 0){
|
||||
Message = Checking For Updates at %GitReleasesAPIURL%
|
||||
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile")
|
||||
|
||||
data := URLDownloadToVar(GitReleasesAPIURL)
|
||||
@@ -15,25 +14,15 @@ CheckForUpdates(GitReleasesAPIURL){
|
||||
Return
|
||||
}
|
||||
|
||||
UpdateVersionNumber := parsed.1.name
|
||||
LatestReleaseVersionNumber := parsed.1.name
|
||||
|
||||
; Message = UpdateVersionNumber: %UpdateVersionNumber%
|
||||
; DevModeMsgBox(Message)
|
||||
|
||||
|
||||
if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){
|
||||
ToolTip
|
||||
return 0
|
||||
}
|
||||
else, {
|
||||
if(CurrentVersionNumber >= LatestReleaseVersionNumber)
|
||||
UpdateAvailable := 0
|
||||
else,
|
||||
UpdateAvailable := 1
|
||||
; msgbox, update found!
|
||||
Message = Program Update Found
|
||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
||||
; IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
; ToolTip
|
||||
return 1
|
||||
}
|
||||
|
||||
ToolTip
|
||||
return UpdateAvailable
|
||||
|
||||
}
|
||||
|
||||
@@ -53,19 +42,13 @@ UpdateScript(){
|
||||
exename := parsed.1.assets.1.name
|
||||
exeURL := parsed.1.assets.1.browser_download_url
|
||||
|
||||
; Msgbox % "UpdateVersionNumber: " UpdateVersionNumber
|
||||
; msgbox, Version: %Version%
|
||||
; Msgbox % "ChangeLog: " ChangeLog
|
||||
; Msgbox % "exeURL: " exeURL
|
||||
; Msgbox % "exename: " exename
|
||||
|
||||
ExeName := StrReplace(exename, ".exe", "")
|
||||
UpdateExeName = %exename% %UpdateVersionNumber%.exe
|
||||
UpdateExeFilepath = %A_ScriptDir%\%UpdateExeName%
|
||||
|
||||
if(ScriptVersion = UpdateVersionNumber){
|
||||
if(ScriptVersion =< UpdateVersionNumber){
|
||||
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
MsgBox, You are Up-To-Date
|
||||
MsgBox, You are Up-To-Date, There are no new updates to download.
|
||||
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
||||
return
|
||||
}
|
||||
@@ -81,10 +64,12 @@ UpdateScript(){
|
||||
}
|
||||
Else IfMsgBox No, {
|
||||
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
; Msgbox, downloading to: %A_ScriptDir%\%UpdateExeName%
|
||||
|
||||
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
||||
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
||||
ExitApp
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ GrabLocalsPostURLUsingTitle(PostTitle){
|
||||
try ElementInnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
|
||||
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
|
||||
if(Devmode){
|
||||
Msgbox % "ElementInnerText: " ElementInnerText "`n" "ElementOuterHTML: " ElementOuterHTML
|
||||
}
|
||||
|
||||
|
||||
if(InStr(ElementInnerText, PostTitle)){
|
||||
Message = Found Post Title in Element Number: %A_index%
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
Function Libraries used in the following Projects:
|
||||
- [Freedomain Social Media Poster](https://freedomain.dev/yuriy/social-media-poster)
|
||||
- [Freedomain Video Uploader](https://freedomain.dev/yuriy/video-uploader)
|
||||
- [Freedomain Clips Uploader](https://freedomain.dev/yuriy/clips-uploader)
|
||||
- [Freedomain Livestream Scheduler](https://freedomain.dev/yuriy/livestream-scheduler)
|
||||
@@ -721,21 +721,27 @@ Selenium_LoopToSendValueByName(ElementName,NumOfLoops:=1,SleepLength:=1000,Strin
|
||||
}
|
||||
|
||||
Selenium_LoopToSendValueToXpath(Xpath,NumOfLoops:=1,SleepLength:=1000,StringTextContent:="",ClearElement:=0){
|
||||
; Msgbox % "StringTextContent: " StringTextContent
|
||||
; Msgbox % "ClearElement: " ClearElement
|
||||
|
||||
loop, %NumOfLoops% {
|
||||
; msgbox % ClearElement
|
||||
|
||||
if(ClearElement){
|
||||
Loop, 3 { ; have to do it multiple times to make it trigger properly
|
||||
Loop, 3 { ; sometimes have to do it multiple times to make it trigger properly
|
||||
Try PreviousValue := driver.findelementbyxpath(Xpath).Attribute("value") ;Xpath Value
|
||||
|
||||
try, driver.FindElementByXPath(Xpath).clear()
|
||||
sleep, 500
|
||||
|
||||
Try CurrentValue := driver.findelementbyxpath(Xpath).Attribute("value") ;Xpath Value
|
||||
|
||||
if(PreviousValue != CurrentValue){
|
||||
break
|
||||
}
|
||||
|
||||
sleep, 1000
|
||||
; msgbox
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
; ToolTip, Loop attempt: %A_index%
|
||||
try driver.FindElementByXPath(Xpath).sendKeys(StringTextContent) ; Click on "upload image" button
|
||||
try driver.FindElementByXPath(Xpath).sendKeys(StringTextContent) ; Input Text
|
||||
catch e {
|
||||
if(A_index = NumOfLoops){
|
||||
Return "Failed"
|
||||
@@ -790,17 +796,27 @@ Selenium_LoopToClickXpathAndWaitForOpenWindow(Xpath,NumOfLoops:=1,SleepLength:=1
|
||||
}
|
||||
|
||||
|
||||
Selenium_LoopToClearXpath(Xpath,NumOfLoops:=1,SleepLength:=1000){
|
||||
loop, %NumOfLoops% {
|
||||
Selenium_LoopToClearXpath(Xpath,NumberOfAttemps:=1,SleepLength:=1000){
|
||||
loop, %NumberOfAttemps% {
|
||||
|
||||
try driver.FindElementByXPath(Xpath).clear()
|
||||
catch e {
|
||||
if(A_index = NumOfLoops){
|
||||
Return "Failed"
|
||||
}
|
||||
|
||||
sleep, %SleepLength%
|
||||
Continue
|
||||
|
||||
try, InerText := driver.findelementbyxpath(Xpath).Attribute("value")
|
||||
; Msgbox % "InerText: " InerText
|
||||
if(InerText = "")
|
||||
return
|
||||
|
||||
if(A_index = NumberOfAttemps){
|
||||
return "Failed after %NumberOfAttemps"
|
||||
}
|
||||
Return
|
||||
|
||||
Continue
|
||||
; Return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -834,12 +850,12 @@ SaveDriverURLOFErrorPage(){ ; save the url of the result page. That way if a tab
|
||||
|
||||
GetHTMLValueFromXpathOuterHTML(XPATH, HTMLElementName){
|
||||
|
||||
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
; try Clipboard := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
; Try MsgBox,,Element OuterHTML: `n, % driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
; try Clipboard := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
; Try MsgBox,,Element OuterHTML: `n, % driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
|
||||
; Match string between quotes following the HTMLELEMENTNAME
|
||||
RegexStatement = %HTMLElementName%="([^"]+)"
|
||||
; Match string between quotes following the HTMLELEMENTNAME
|
||||
RegexStatement = %HTMLElementName%="([^"]+)"
|
||||
|
||||
; regexMatch := RegExMatch(ElementOuterHTML, "value=""([^""]+)""", match)
|
||||
regexMatch := RegExMatch(ElementOuterHTML, RegexStatement, match)
|
||||
|
||||
197
Shared-GoTos.ahk
Normal file
197
Shared-GoTos.ahk
Normal file
@@ -0,0 +1,197 @@
|
||||
; This #include needs to be at the bottom of the parent script
|
||||
|
||||
|
||||
|
||||
CheckForUpdates:
|
||||
UpdateStartTime := A_TickCount ; start time
|
||||
|
||||
|
||||
; The GUI buttons must have variable set to vUpdateAvailable and vChromeUpdateAvailable for button to get updated
|
||||
|
||||
; The following variables need to be set in the parent script
|
||||
; GitReleasesAPIURL
|
||||
; ChromeFilepath
|
||||
|
||||
Message = Checking for Updates
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
if(CheckForUpdates(GitReleasesAPIURL, ScriptVersion)){
|
||||
GuiControl,,UpdateAvailable, Update Available!
|
||||
}
|
||||
|
||||
; check for Post Scheduler Update
|
||||
if(ScriptNameAcronym = "FVU"){
|
||||
if(CheckForUpdates(PostSchedulerGitReleasesAPIURL, PostSchedulerVersion)){
|
||||
GuiControl,,PostSchedulerUpdateAvailable, FPS Update Available!
|
||||
}
|
||||
}
|
||||
|
||||
if(CheckForChromeUpdates(ChromeFilepath)){
|
||||
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
||||
ChromeUpdateAvailable := 1
|
||||
}
|
||||
|
||||
; calculate run time and convert to seconds
|
||||
TimeToCheckforUpdates := round(((A_TickCount - UpdateStartTime) / 1000), 2)
|
||||
|
||||
Message = Update Check took %TimeToCheckforUpdates% seconds to complete
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
; Msgbox % "TimeToCheckforUpdates: " TimeToCheckforUpdates
|
||||
; Msgbox % "URunTime: " URunTime
|
||||
|
||||
ToolTip
|
||||
Return
|
||||
|
||||
; UpdatePostScheduler:
|
||||
|
||||
|
||||
|
||||
Return
|
||||
|
||||
|
||||
UpdateChrome:
|
||||
|
||||
; if chroem doesn't exist, download it
|
||||
if(ChromeFilepath = ""){
|
||||
Status := DownloadLatestChromium()
|
||||
if(Status)
|
||||
GuiControl,,ChromeUpdateAvailable, Chrome Up-To-Date
|
||||
Return
|
||||
}
|
||||
|
||||
if(CheckForChromeUpdates = "")
|
||||
Status := CheckForChromeUpdates(ChromeFilepath)
|
||||
|
||||
if(!status){
|
||||
OnMessage(0x44, "OnMsgBoxConfirmChromiumOverwrite")
|
||||
MsgBox 0x41, Already Up-to-Date, Yor current Chromium version is already up to date. `nDo you want to download and overwrite it?
|
||||
OnMessage(0x44, "")
|
||||
|
||||
IfMsgBox OK, {
|
||||
Return
|
||||
} Else IfMsgBox Cancel, {
|
||||
ToolTip
|
||||
}
|
||||
}
|
||||
|
||||
Status := DownloadLatestChromium()
|
||||
if(Status)
|
||||
GuiControl,,ChromeUpdateAvailable, Chrome Up-To-Date
|
||||
|
||||
Return
|
||||
/*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
PasteClipboardToEditBox:
|
||||
if(A_GuiControl = "PasteClipboardToSMPBody"){
|
||||
GuiControl,,PostBody, %Clipboard%
|
||||
}
|
||||
|
||||
if(A_GuiControl = "PasteClipboardToSMPTitle"){
|
||||
GuiControl,,PostTitle, %Clipboard%
|
||||
}
|
||||
|
||||
if(A_GuiControl = "PasteClipboardToFLSTitle"){
|
||||
GuiControl,,LivestreamTitle, %Clipboard%
|
||||
}
|
||||
|
||||
if(A_GuiControl = "PasteClipboardToFLSDescription"){
|
||||
GuiControl,,LivestreamDescription, %Clipboard%
|
||||
}
|
||||
|
||||
if(A_GuiControl = "PasteClipboardToFLSTags"){
|
||||
GuiControl,,LivestreamTags, %Clipboard%
|
||||
}
|
||||
|
||||
|
||||
Return
|
||||
|
||||
OpenErrorLog:
|
||||
run, %ErrorLoggingFilePath%
|
||||
Return
|
||||
|
||||
OpenGiteaPage:
|
||||
if(ScriptAbbreviatedName = "FLS")
|
||||
URL = https://freedomain.dev/yuriy/livestream-scheduler
|
||||
|
||||
if(ScriptAbbreviatedName = "FVU")
|
||||
URL = https://freedomain.dev/yuriy/video-uploader
|
||||
|
||||
if(ScriptAbbreviatedName = "FSMP")
|
||||
URL = https://freedomain.dev/yuriy/social-media-poster
|
||||
|
||||
|
||||
run, %URL%
|
||||
Return
|
||||
|
||||
|
||||
|
||||
|
||||
UpdatePostScheduler:
|
||||
; Close any existing instances of the Post Scheduler
|
||||
|
||||
; Kill any active intances of the Post Scheduler so the .exe file can be overwriten
|
||||
process, close, Freedomain Post Scheduler.exe
|
||||
|
||||
|
||||
; Msgbox % "PostSchedulerGitReleasesAPIURL: " PostSchedulerGitReleasesAPIURL
|
||||
data := URLDownloadToVar(PostSchedulerGitReleasesAPIURL)
|
||||
|
||||
try parsed := JSON.Load(data)
|
||||
catch e {
|
||||
Message = Failed to check for updates. Gitea Releases API returned blank or malformed data.
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
UpdateVersionNumber := parsed.1.name
|
||||
ChangeLog := parsed.1.body
|
||||
exename := parsed.1.assets.1.name
|
||||
exeURL := parsed.1.assets.1.browser_download_url
|
||||
|
||||
|
||||
|
||||
; Msgbox % "exename: " exename
|
||||
|
||||
; ExeName := StrReplace(exename, ".exe", "")
|
||||
; UpdateExeName = %exename%.exe
|
||||
UpdateExeFilepath = %A_ScriptDir%\%ExeName%
|
||||
|
||||
if(PostSchedulerVersion =< UpdateVersionNumber){
|
||||
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
MsgBox, You are Up-To-Date, There are no new updates to download.
|
||||
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
||||
return
|
||||
}
|
||||
|
||||
Changelog = %PostSchedulerVersion% --> %UpdateVersionNumber%`n`nChangelog:`n%Changelog%
|
||||
|
||||
OnMessage(0x44, "OnMsgBoxUpdateAvailable")
|
||||
MsgBox 0x44, Update Available For %exename%, %Changelog%
|
||||
OnMessage(0x44, "")
|
||||
|
||||
IfMsgBox Yes, {
|
||||
Return
|
||||
}
|
||||
Else IfMsgBox No, {
|
||||
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
if(FileExist(UpdateExeFilepath)){
|
||||
FileDelete, %UpdateExeFilepath%
|
||||
if(ErrorLevel){
|
||||
Message = Failed to Delete %UpdateExeFilepath%. `nPlease Close the process manually and try the update again.
|
||||
MsgBox 0x10,, %Message%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
||||
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
||||
ToolTip
|
||||
; ExitApp
|
||||
}
|
||||
return
|
||||
1
Update-Functions.ahk
Normal file
1
Update-Functions.ahk
Normal file
@@ -0,0 +1 @@
|
||||
; Code migrated to Shared-GoTo's
|
||||
Reference in New Issue
Block a user