Thanks for the tips Stephen.

I just cleaned up my code and decided to keep my printver.exe > txt version
because it is a little more "transparent".

I wrote it in vbs to use FSO and WSH.
If anyone is interested:

https://www.4shared.com/file/yhMpB-0r/mCheckFileVer.html

Event Function Code:

function siOnBeginSceneSaveEvent_OnEvent( in_ctxt )
   Application.LogMessage "siOnBeginSceneSaveEvent_OnEvent called",siVerbose

   FilePath = Application.ActiveProject2.ActiveScene.filename.value
   splitFilePath = Split(FilePath, "\")
   ScnName = splitFilePath(Ubound(splitFilePath))

   if ScnName <> "Untitled.scn" then
      TempPath = XSIUtils.Environment("TEMP")
      BinPath = XSIUtils.Environment("XSI_BINDIR")

      set FSO = CreateObject( "Scripting.FileSystemObject" )
      set WshShell = CreateObject( "WScript.Shell" )

   'Run PrintVer and print result to a txt file
      WshShell.run "cmd /c printver.exe " & FilePath & " > " &
TempPath & "\ver.txt" & """", 0, 1

   'Get File Version (Read Text)
      GetVer = FSO.OpenTextFile(TempPath & "\ver.txt", 1).ReadLine
      FileVer = Right(GetVer, Len(GetVer) - InStr(GetVer, ": ") -1)
      FileVerMaj = Split(FileVer, ".")(0)
   'Delete Text
      FSO.DeleteFile TempPath & "\ver.txt"

   'Get App Version and Compare
      AppVer = Application.Version
      AppVerMaj = Split(AppVer, ".")(0)

      if AppVerMaj <> FileVerMaj then
         logmessage "-----------------------------------------------------"
         logmessage "Current Scene File Version : " & FileVer
         logmessage "Softimage Version          : " & AppVer
         logmessage "-----------------------------------------------------"
         SaveQuestion = Msgbox ("You are going to save in a newer
Softimage version." & vbNewline & vbNewline & "Are you sure?", 1 + 48,
"Different Version Warning")
      end if

      if SaveQuestion = 2 then
         logmessage "Scene not saved - Command was cancelled.", siWarning
         siOnBeginSceneSaveEvent_OnEvent = True
      else
         logmessage "Scene Saved"
         siOnBeginSceneSaveEvent_OnEvent = False
      end if

   else
      siOnBeginSceneSaveEvent_OnEvent = False
   end if
   end function


M.Yara




On Sat, May 12, 2012 at 7:40 PM, Stephen Blair
<stephen.bl...@autodesk.com>wrote:

> Hi
>
> Here's one way to get the info from printver
>
> http://xsisupport.wordpress.com/2012/05/12/checking-the-version-used-to-create-a-scene/
>
>
>
>
> Stephen Blair
> M&E Technical Lead, Product Support
> Global Services
>
> Autodesk, Inc.
> Montreal, Quebec, Canada
> Blog: http://xsisupport.wordpress.com
>
>

Reply via email to