;IP Detect Update script ;© 2019 by Daniel Chavez ;Purpose: This updates iP Detect if there are changes #include #include #include #include Global $serverVersionFile = "https://mydomain.us/win/IPDetectData/version.txt" Global $UpdatePathIs = @ScriptDir & "\GetIPV2.exe" $serverUpdateExe = "https://mydomain.us/win/GetIPV2.exe" global $ToBeReplacedPathIs = @ScriptDir & "\GetIP.exe" Global $doDownload Global $updateFailed Global $retryornot GetCurrentSoftwareVersion() doVersionCheck() Func GetCurrentSoftwareVersion() Global $localEXEversion = "" FileGetVersion($ToBeReplacedPathIs) Global $remoteEXEversion = _INetGetSource($serverVersionFile) EndFunc Func doVersionCheck() If $localEXEversion < $remoteEXEversion Then MsgBox(0,"","Server version higher, let's update it") Global $doDownload = InetGet($serverUpdateExe, $UpdatePathIs, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do Sleep(250) Until InetGetInfo ($doDownload, $INET_DOWNLOADCOMPLETE) MsgBox(0,"Download Finished","download completed", 3) DownloadDeleteRename() EndIf EndFunc Func DownloadDeleteRename() FileDelete ($ToBeReplacedPathIs) FileMove ($UpdatePathIs,$ToBeReplacedPathIs,1) GetCurrentSoftwareVersion() MsgBox(0,"",$localEXEversion & $remoteEXEversion) If $localEXEversion = $remoteEXEversion Then Global $updateFailed = false ConsoleWrite($updateFailed) Else $retryornot = MsgBox(16 + 5,"Update error detected","Likely cause: Firewall/Antivirus prevented the download. ") Global $updateFailed = true ConsoleWrite($updateFailed) EndIf If $retryornot = 4 Then GetCurrentSoftwareVersion() doVersionCheck() Else exit EndIf EndFunc