|
|
|
@ -39,99 +39,65 @@ CheckForUpdates(){
|
|
|
|
|
|
|
|
|
|
parsed := JSON.Load(data)
|
|
|
|
|
|
|
|
|
|
Version := parsed.1.name
|
|
|
|
|
UpdateVersionNumber := parsed.1.name
|
|
|
|
|
|
|
|
|
|
; msgbox, Version: %Version%`nScriptVersion: %ScriptVersion%
|
|
|
|
|
|
|
|
|
|
if(ScriptVersion = Version){
|
|
|
|
|
if(ScriptVersion = UpdateVersionNumber){
|
|
|
|
|
ToolTip
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
else, {
|
|
|
|
|
; msgbox, update found!
|
|
|
|
|
; Message = Program Update Found
|
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
|
|
|
|
IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
|
|
|
|
|
|
|
|
|
; GuiControl,, UpdateAvailable, Update Available - Click to View
|
|
|
|
|
}
|
|
|
|
|
; return
|
|
|
|
|
|
|
|
|
|
; @todo DELETE the rest of this.
|
|
|
|
|
/*
|
|
|
|
|
Msgbox % "Version: " Version
|
|
|
|
|
ChangeLog := parsed.1.body
|
|
|
|
|
exename := parsed.1.assets.1.name
|
|
|
|
|
exeURL := parsed.1.assets.1.browser_download_url
|
|
|
|
|
Msgbox % "exeURL: " exeURL
|
|
|
|
|
Msgbox % "exename: " exename
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(True)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Msgbox % "FreedomScriptsChangelogURL: " FreedomScriptsChangelogURL
|
|
|
|
|
; Msgbox % "ChangelogIniFilepath: " ChangelogIniFilepath
|
|
|
|
|
; Msgbox % "ScriptSettingsSectio: " ScriptSettingsSection
|
|
|
|
|
; Msgbox % "SettingsIniFilepath: " SettingsIniFilepath
|
|
|
|
|
UpdateAvailable := 1
|
|
|
|
|
; msgbox, update found!
|
|
|
|
|
Message = Program Update Found
|
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
|
|
|
|
; IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
|
|
|
|
; ToolTip
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UrlDownloadToFile, %FreedomScriptsChangelogURL%, %ChangelogIniFilepath%
|
|
|
|
|
if(ErrorLevel){
|
|
|
|
|
Message = Failed to Download Changelog
|
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
|
|
|
Return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IniRead, UpdateVersion, %ChangelogIniFilepath%, %ScriptSettingsSection%, ScriptVersion, %A_Space%
|
|
|
|
|
if(UpdateVersion = ""){
|
|
|
|
|
ToolTip
|
|
|
|
|
; MsgBox, update version is blank.
|
|
|
|
|
Return
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ScriptVersion != UpdateVersion){
|
|
|
|
|
; msgbox, update found!
|
|
|
|
|
Message = Script Update Found
|
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
|
|
|
|
IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
|
|
|
|
UpdateScript(){
|
|
|
|
|
data := URLDownloadToVar(GitReleasesAPIURL)
|
|
|
|
|
|
|
|
|
|
GuiControl,, UpdateAvailable, Update Available - Click to View
|
|
|
|
|
}
|
|
|
|
|
else, {
|
|
|
|
|
Message = No Updates Found
|
|
|
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
|
|
|
|
IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
|
|
|
|
parsed := JSON.Load(data)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
ToolTip
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
UpdateVersionNumber := parsed.1.name
|
|
|
|
|
ChangeLog := parsed.1.body
|
|
|
|
|
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%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UpdateScript(){
|
|
|
|
|
; Msgbox % "ChangelogIniFilepath: " ChangelogIniFilepath
|
|
|
|
|
; Msgbox % "ScriptSettingsSection: " ScriptSettingsSection
|
|
|
|
|
|
|
|
|
|
IniRead, Changelog, %ChangelogIniFilepath%, %ScriptSettingsSection%, Changelog, %A_Space%
|
|
|
|
|
Changelog := StrReplace(Changelog, "--", "`n-")
|
|
|
|
|
; IniRead, Changelog, %ChangelogIniFilepath%, %ScriptSettingsSection%, Changelog, %A_Space%
|
|
|
|
|
; Changelog := StrReplace(Changelog, "--", "`n-")
|
|
|
|
|
|
|
|
|
|
IniRead, UpdateVersion, %ChangelogIniFilepath%, %ScriptSettingsSection%, ScriptVersion, %A_Space%
|
|
|
|
|
; IniRead, UpdateVersion, %ChangelogIniFilepath%, %ScriptSettingsSection%, ScriptVersion, %A_Space%
|
|
|
|
|
|
|
|
|
|
if(ScriptVersion = UpdateVersion){
|
|
|
|
|
IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
|
|
|
|
if(ScriptVersion = UpdateVersionNumber){
|
|
|
|
|
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
|
|
|
|
MsgBox, You are Up-To-Date
|
|
|
|
|
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Changelog = %ScriptVersion% -> %UpdateVersion%`n`n-%Changelog%
|
|
|
|
|
Changelog = %ScriptVersion% --> %UpdateVersionNumber%`n%Changelog%
|
|
|
|
|
|
|
|
|
|
OnMessage(0x44, "OnMsgBoxUpdateAvailable")
|
|
|
|
|
MsgBox 0x44, Update Available, %Changelog%
|
|
|
|
@ -140,8 +106,10 @@ UpdateScript(){
|
|
|
|
|
IfMsgBox Yes, {
|
|
|
|
|
Return
|
|
|
|
|
} Else IfMsgBox No, {
|
|
|
|
|
run, "%FreedomainProgramUpdaterFilepath%" "%ScriptSettingsSection%"
|
|
|
|
|
; Return
|
|
|
|
|
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
|
|
|
Msgbox, downloading to: %A_ScriptDir%\%UpdateExeName%
|
|
|
|
|
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
|
|
|
|
run, %UpdateExeFilepath% %A_ScriptFullPath%
|
|
|
|
|
ExitApp
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|