In order to ensure that the device is running the latest version of an ITB, it may be necessary to compare the device ITB version to the OMNI Server ITB version. There are a few functions in ITScriptNet that can be used for this purpose.
First, the version of the ITB should be set in the Program Designer. This is a field on the Program Settings screen. You must remember to change the version number whenever you are ready to deploy a new version.
Now you have to decide when to check the version. You can add an Update button, or perhaps check in the Before Prompting script of the first prompt.
To check the version, use the RemoteGetITBVersion function to query the OMNI Server for the version of the ITB that is on the PC. This function can check the version of any ITB, not just the currently running program. You must specify the name of the ITB, but you can use the constant like this:
@ServerVer@ = RemoteGetITBVersion( sysITBFile )
The version of the currently running ITB on the device can be retrieved using the progITBVersion constant.
Now you can compare them, and if the versions do not match, use the OmniLoadProgram function to get the updated program from the server.
Putting it all together, here is the script that will query the OMNI Server and update the program:
; get the server program version
@ServerVer@ = RemoteGetITBVersion(sysITBFile)
; does it match this program's version?
if(@ServerVer@ <> progITBVersion)
; no - update!
@ret@ = OmniLoadProgram(sysITBFile, 1)
; did it load?
if(@ret@ <> 0)
; restart the program
ExitProgram(1)
endif
else
Message("No update needed!")
endif