OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username:
Password:
CapsLock is on.
Remember me (for 1 year)
Log in
Home
Tutorials
Tutorials Home
Basic Tutorials
Intermediate Tutorials
Mad Marx Tutorials
In Depth Tutorials
Older Tutorials
External Tutorials
Cookbook
Cookbook Home
CodeBank
Snippets
Experiences
Ogre Articles
Libraries
Libraries Home
Alternative Languages
Assembling A Toolset
Development Tools
OGRE Libraries
List of Libraries
Tools
Tools Home
DCC Tools
DCC Tutorials
DCC Articles
DCC Resources
Assembling a production pipeline
Development
Development Home
Roadmap
Building Ogre
Installing the Ogre SDK
Setting Up An Application
Ogre Wiki Tutorial Framework
Frequently Asked Questions
Google Summer Of Code
Help Requested
Ogre Core Articles
Community
Community Home
Projects Using Ogre
Recommended Reading
Contractors
Wiki
Immediate Wiki Tasklist
Wiki Ideas
Wiki Guidelines
Article Writing Guidelines
Wiki Styles
Wiki Page Tracker
Ogre Wiki Help
Ogre Wiki Help Overview
Help - Basic Syntax
Help - Images
Help - Pages and Structures
Help - Wiki Plugins
Toolbox
Freetags
Categories
List Pages
Structures
Trackers
Statistics
Rankings
List Galleries
Ogre Lexicon
Comments
History: Query Ogre Version
View page
Source of version: 6
(current)
{maketoc} !!About "Query Ogre Version" The following tool is designed for Windows (it has been tested on Windows XP). It adds a shell extension under the explorer and allows you to query the version of Ogre, the file (or the directory) is belong to. Once you have merged the .reg file, you can right click a file (or a directory) and select the "Query Ogre Version" entry. !!Source Code __queryOgreVersion.reg__ {CODE(wrap="1", colors="reg")}Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\OgreVersion] @="Query Ogre3D version" [HKEY_CLASSES_ROOT\*\shell\OgreVersion\command] @="wscript.exe your_path_here\\queryOgreVersion.vbs \"%1\"" [HKEY_CLASSES_ROOT\Directory\shell\OgreVersion] @="Query Ogre3D version" [HKEY_CLASSES_ROOT\Directory\shell\OgreVersion\command] @="wscript.exe your_path_here\\queryOgreVersion.vbs \"%1\""{CODE} __queryOgreVersion.vbs__ {CODE(wrap="1", colors="vb")}' VB Script Document Dim gSHELL Dim gFSO Dim gARGS Set gArgs = WScript.Arguments Set gSHELL = CreateObject( "WScript.Shell" ) Set gFSO = CreateObject( "Scripting.FileSystemObject" ) '------------------------------------------------------------------------------- function FindOgreHeader( in_path ) result ="" path = in_path If not(gFSO.FolderExists(path)) Then call SplitFilename(path, directory, basefilename, extension ) path = directory if not(gFSO.FolderExists(path)) Then FindOgreHeader = result exit function end if end if path = Lcase(path) tokens = Split( path, "\" ) nbTokens=UBound(tokens)+1 ogreHeader = "\ogreMain\include\OgrePrerequisites.h" concat = "" for i=0 to nbTokens-1 concat = concat & tokens(i) if gFSO.FileExists(concat & ogreHeader ) then result = concat & ogreHeader exit for end if concat = concat & "\" next FindOgreHeader = result end function '------------------------------------------------------------------------------- function MySplit( in_text) Dim NumWords, a() NumWords = 0 spaceTokens = Split( in_text, " ") nbSpaceToken =UBound(spaceTokens) for i=0 to nbSpaceToken tabTokens = Split( spaceTokens(i), vbTab ) nbTabToken = UBound( tabTokens ) if( nbTabToken=0 ) then redim preserve a(NumWords+1) a(NumWords) = spaceTokens(i) NumWords = NumWords + 1 else for j = 0 to nbTabToken if tabTokens(j)<>"" then redim preserve a(NumWords+1) a(NumWords) = tabTokens(j) NumWords = NumWords + 1 end if next end if next MySplit = a end function '------------------------------------------------------------------------------- function UnQuote(in_text) result = in_text if Len(in_text)>=2 then if Right(in_text,1)="""" and left(in_text,1)="""" then result = Mid(in_text, 2, Len(in_text)-2) end if end if UnQuote = result end function '------------------------------------------------------------------------------- function GetOgreVersion( in_path ) result = "not found!" ogreHeader = FindOgreHeader( in_path ) if ogreHeader<>"" then Set inputFile = gFSO.OpenTextFile(ogreHeader, 1) major= "" minor = "" patch = "" name = "" ended = false count = 0 line = 0 Do While ((inputFile.AtEndOfStream <> True) and not(ended)) line = line + 1 readBuffer = Trim(inputFile.ReadLine) tokens = MySplit( readBuffer) on error resume next nbTokens=UBound(tokens) If err.number <> 0 then nbTokens = 0 end if On Error Goto 0 if nbTokens>=3 then if tokens(0)="#define" then if tokens(1)="OGRE_VERSION_MAJOR" then major = tokens(2) count = count+1 elseif tokens(1)="OGRE_VERSION_MINOR" then minor = tokens(2) count = count+1 elseif tokens(1)="OGRE_VERSION_PATCH" then patch = tokens(2) count = count+1 elseif tokens(1)="OGRE_VERSION_SUFFIX" then suffix = tokens(2) count = count+1 elseif tokens(1)="OGRE_VERSION_NAME" then name = tokens(2) count = count+1 end if end if end if if count=5 then ended = true end if Loop inputFile.Close result = major & "." & minor & "." & patch & " " & UnQuote(suffix) & vbCrLf & "codename = " & UnQuote(name) end if GetOgreVersion = result end function '------------------------------------------------------------------------------- Sub SplitFilename( inFilename, outDirectory, outBaseFilename, outExtension ) posSlash = InStrRev( inFilename, "/" ) posAntislash = InStrRev( inFilename, "\" ) posDirectory = posSlash If ( posAntislash > posSlash ) Then posDirectory = posAntislash End If outDirectory = Mid( inFilename, 1, posDirectory ) outBaseFilename = Right( inFilename, len(inFilename)-posDirectory ) posExtension = InStrRev( outBaseFilename, "." ) outExtension = Right( outBaseFilename, len(outBaseFilename)-posExtension ) if posExtension<>0 then outBaseFilename = Left( outBaseFilename, posExtension-1) end if End Sub '----------------------------------- MAIN -------------------------------------- if( gArgs.Count>=0 ) then path = gArgs(0) version = GetOgreVersion( path ) msgbox "version="&version, vbInformation, "Ogre3D Information" end if{CODE}
Search by Tags
Search Wiki by Freetags
Latest Changes
One Function Ogre
IDE Eclipse
FMOD SoundManager
HDRlib
Building Ogre V2 with CMake
Ogre 2.1 FAQ
Minimal Ogre Collision
Artifex Terra
OpenMB
Advanced Mogre Framework
...more
Search
Find
Advanced
Search Help
Online Users
169 online users