Get Module Version Information

Recently I needed to add the version information to a display screen so that it showed mymodule 1.0.2 as opposed to the standard mymodule. The following function returns the version information for a specified module :
				function List getVersionInfo(String modulename)
				    List versionList = {}
				    Object module = $Kernel.ModuleSubsystem.GetItem(modulename)

				    if ( !IsError( module ) )
				        versionList = module.VersionList()
				    end

				    return versionList
				end
			
This returns either an empty List, if the module is not installed, or a list containing the four elements of the module's WebModule.fVersion feature, which is usually in the format {'1','0','r','2'}, so to show just the version numbers we can use the following :
				List versionInfo = getVersionInfo("mymodule")
				echo(Str.Format("my module %1.%2.%3,versionInfo[1],versionInfo[2],versionInfo[4]))
			
This would output my module 1.0.2 using the same version information feature value shown above.
Website Designed by Adservio Consulting Valid HTML 4.01 Strict    Valid CSS!    Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0