Compare commits
2 Commits
a3d89a9892
...
6bf72336d0
| Author | SHA1 | Date | |
|---|---|---|---|
| 6bf72336d0 | |||
| fd6be690da |
@@ -117,7 +117,7 @@ SendTelegramMessage(token, chatID, text := "", ParseMode := "MarkdownV2")
|
|||||||
json_resp := whr.ResponseText
|
json_resp := whr.ResponseText
|
||||||
whr := ; free COM object
|
whr := ; free COM object
|
||||||
; Msgbox % "json_resp: " json_resp
|
; Msgbox % "json_resp: " json_resp
|
||||||
if(InStr(json_resp, "error_code"))
|
; if(InStr(json_resp, "error_code"))
|
||||||
Return json_resp
|
Return json_resp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
; GITEA Functions
|
; GITEA Functions
|
||||||
;------------------------------------------------
|
;------------------------------------------------
|
||||||
CheckForUpdates(GitReleasesAPIURL){
|
CheckForUpdates(GitReleasesAPIURL, CurrentVersionNumber := 0){
|
||||||
; msgbox, checking for updates
|
Message = Checking For Updates at %GitReleasesAPIURL%
|
||||||
Message = Checking For Updates
|
|
||||||
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile")
|
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile")
|
||||||
|
|
||||||
data := URLDownloadToVar(GitReleasesAPIURL)
|
data := URLDownloadToVar(GitReleasesAPIURL)
|
||||||
@@ -15,25 +14,15 @@ CheckForUpdates(GitReleasesAPIURL){
|
|||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateVersionNumber := parsed.1.name
|
LatestReleaseVersionNumber := parsed.1.name
|
||||||
|
|
||||||
; Message = UpdateVersionNumber: %UpdateVersionNumber%
|
if(CurrentVersionNumber >= LatestReleaseVersionNumber)
|
||||||
; DevModeMsgBox(Message)
|
UpdateAvailable := 0
|
||||||
|
else,
|
||||||
|
|
||||||
if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){
|
|
||||||
ToolTip
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
else, {
|
|
||||||
UpdateAvailable := 1
|
UpdateAvailable := 1
|
||||||
; msgbox, update found!
|
|
||||||
Message = Program Update Found
|
ToolTip
|
||||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
return UpdateAvailable
|
||||||
; IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
|
||||||
; ToolTip
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,19 +42,13 @@ UpdateScript(){
|
|||||||
exename := parsed.1.assets.1.name
|
exename := parsed.1.assets.1.name
|
||||||
exeURL := parsed.1.assets.1.browser_download_url
|
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", "")
|
ExeName := StrReplace(exename, ".exe", "")
|
||||||
UpdateExeName = %exename% %UpdateVersionNumber%.exe
|
UpdateExeName = %exename% %UpdateVersionNumber%.exe
|
||||||
UpdateExeFilepath = %A_ScriptDir%\%UpdateExeName%
|
UpdateExeFilepath = %A_ScriptDir%\%UpdateExeName%
|
||||||
|
|
||||||
if(ScriptVersion = UpdateVersionNumber){
|
if(ScriptVersion =< UpdateVersionNumber){
|
||||||
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
; 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
|
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -81,10 +64,12 @@ UpdateScript(){
|
|||||||
}
|
}
|
||||||
Else IfMsgBox No, {
|
Else IfMsgBox No, {
|
||||||
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||||
; Msgbox, downloading to: %A_ScriptDir%\%UpdateExeName%
|
|
||||||
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
||||||
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
||||||
ExitApp
|
ExitApp
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
102
Shared-GoTos.ahk
102
Shared-GoTos.ahk
@@ -1,31 +1,53 @@
|
|||||||
; This #include needs to be at the bottom of the parent script
|
; This #include needs to be at the bottom of the parent script
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CheckForUpdates:
|
CheckForUpdates:
|
||||||
|
UpdateStartTime := A_TickCount ; start time
|
||||||
|
|
||||||
|
|
||||||
; The GUI buttons must have variable set to vUpdateAvailable and vChromeUpdateAvailable for button to get updated
|
; 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
|
; The following variables need to be set in the parent script
|
||||||
; GitReleasesAPIURL
|
; GitReleasesAPIURL
|
||||||
; ChromeFilepath
|
; ChromeFilepath
|
||||||
|
|
||||||
; Message = Checking for Updates
|
Message = Checking for Updates
|
||||||
; SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||||
|
|
||||||
|
if(CheckForUpdates(GitReleasesAPIURL, ScriptVersion)){
|
||||||
|
GuiControl,,UpdateAvailable, Update Available!
|
||||||
|
}
|
||||||
|
|
||||||
if(CheckForUpdates(GitReleasesAPIURL)){
|
; check for Post Scheduler Update
|
||||||
GuiControl,,UpdateAvailable, %ScriptAbbreviatedName% Update Available!
|
if(ScriptNameAcronym = "FVU"){
|
||||||
|
if(CheckForUpdates(PostSchedulerGitReleasesAPIURL, PostSchedulerVersion)){
|
||||||
|
GuiControl,,PostSchedulerUpdateAvailable, FPS Update Available!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CheckForChromeUpdates(ChromeFilepath)){
|
if(CheckForChromeUpdates(ChromeFilepath)){
|
||||||
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
||||||
; ChromeUpdateAvailable := 1
|
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
|
ToolTip
|
||||||
Return
|
Return
|
||||||
|
|
||||||
|
; UpdatePostScheduler:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Return
|
||||||
|
|
||||||
|
|
||||||
UpdateChrome:
|
UpdateChrome:
|
||||||
|
|
||||||
@@ -103,3 +125,73 @@ if(ScriptAbbreviatedName = "FSMP")
|
|||||||
|
|
||||||
run, %URL%
|
run, %URL%
|
||||||
Return
|
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
|
||||||
Reference in New Issue
Block a user