Originally posted by baudi
View Post
I have modified it slightly to put the info in two virtual devices and also send an email. You'd need to manually create two virtual devices and edit the script with the reference IDs for them, and also the line for sending the email with your own from/to email addresses. i have an event that runs the script on a daily basis.
Code:
Imports System.Diagnostics Sub Main(ByVal Parm As Object) Dim logName As String = "HS3 Update Check" Dim Debug As Boolean = False Try 'This script will download the file to check whether or not the version running is the latest HS3 version Dim ReplyFull As String = hs.geturl("http://www.homeseer.com", "/updates3/hs3update.txt", False, 80) If ReplyFull IsNot Nothing Then Dim SplLine() As String = ReplyFull.Split(vbCr) Dim LatestVersion As String = SplLine(9).Replace("Version = ", Nothing).Trim If Debug Then hs.writelog(logName, "Latest HS3 Version: " & LatestVersion) 'now we have the latest version in the update.txt file, find the latest version in the HS3 EXE file Dim HS3VersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(hs.getapppath & "\HS3.exe") Dim CurrentVersion As String = HS3VersionInfo.FileVersion If Debug Then hs.writelog(logName, "Installed HS3 Version: " & CurrentVersion) Dim CurrentInstalledVersion As String = hs.devicestring([B]6349[/B]) Dim CurrentReleasedVersion As String = hs.devicestring([B]6350[/B]) If CurrentVersion <> CurrentInstalledVersion Then hs.setdevicestring([B]6349[/B],CurrentVersion,True) If LatestVersion = CurrentVersion Then If Debug Then hs.writelog(logName, "You Have the Latest Version Installed") ElseIf CurrentReleasedVersion <> LatestVersion Then If Debug Then hs.writelog(logName, "You Don't Have the Latest Version Installed") 'hs.SendEmail("[B]home-warning@xyz.com[/B]","[B]homeseer@xyz.com[/B]","","","New HS3 Version Released","*** New HS3 Version Released: " & LatestVersion & " ***","") hs.setdevicestring([B]6350[/B],latestversion,True) End If End If Catch ex As Exception : hs.writelog(logName, "Error: " & ex.Message.ToString) End Try End Sub
Comment