Ah I see. You are just using pastebin as the example for where the code and version number is located.
What about with external variables? Could the user grab the variable information and be able to access it in a similar way like so?
Code: Select all
#SingleInstance, Force
Version := "0.2"
WebVersion := CheckVersion()
If (WebVersion = "") {
MsgBox, You appear to be offline, or can't reach the update server.`n`nPlease be aware that you may be using an outdated version.
} Else If (WebVersion <> Version) {
MsgBox, 4, Update, Your script is outdated.`nThe latest version is %WebVersion%, but you are running %Version%.`n`nWould you like to update?
IfMsgBox Yes
Update()
} Else {
MsgBox,, Success, You have the latest version! Congratulations!
ObtainData() ;<----- This would be where the user could download the data if they needed to
}
CheckVersion() {
HttpRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
HttpRequest.Open("GET", "https://pastebin.com/raw/VSemjLGC", true)
HttpRequest.Send()
HttpRequest.WaitForResponse()
return HttpRequest.ResponseText
}
Update() {
HttpRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
HttpRequest.Open("GET", "https://pastebin.com/raw/5amYKcr0", true)
HttpRequest.Send()
HttpRequest.WaitForResponse()
FileOpen(A_ScriptFullPath, "w").Write(HttpRequest.ResponseText)
Run, % A_ScriptFullPath
}
ObtainData() {
Lib := A_ScriptFullPath\Lib\DataFile.ahk
HttpRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
HttpRequest.Open("GET", "https://pastebin.com/raw/*InsertPastbinNumberHere", true)
HttpRequest.Send()
HttpRequest.WaitForResponse()
FileOpen(Lib, "w").Write(HttpRequest.ResponseText)
}
What would be needed to use the variables from that list?
Example of what the variables look like
Code: Select all
a := ["111", "112", "113"]
b := ["211", "212"]
c := ["311", "312", "313"]
Letters := a|b|c
So that way the user can have the updated data of that list when it changes. The main reason why I am curious about external variables is because I don't want a user to have to update every time I update 1 or 2 characters for a variable for the main code, plus it helps to clean up the code by not having an entire list of arrays/objects that require more updating than the main code.