Free Trial Software Downloads Command-line Resource Editor
Heaventools Home
 

home      products      solutions     news     downloads     order     support     about us

 

 
Resource Tuner Console Feature Tour
 

 

start | next 

Console Resource Editor

Easy Way to Update The Version Information

Application developers often need a command-line utility to allow modification of file version information on existing Windows EXE or DLL files. While these files already contain a Version Info resource (embedded into the executable during linking), Resource Tuner Console enables you to automatically stamp their version during the release process to insure consistency. If these files contain no Version Information resource, Resource Tuner Console will create this resource for you. Every field in the VERSIONINFO structure is under your control.

For instance, you have got code that depends on the value of the "Product Version" property of the setup.exe file, and the installations you have generated are missing the "build #" portion of that version. You may use Resource Tuner GUI to modify the properties of the setup.exe after you build it, but it is a manual process that you would rather not have to do every time you build a new release.

From now on, you don't have to change file version information manually every time you rebuild your project. With the File Version Info operations of RTC, it is very easy and convenient to manage files' version information. Let's get started with the Version Information automation.

1. Prepare a simple script (see below)
2. Run Resource Tuner Console
3. You are done.

The File Version Information before:

Child Type: StringFileInfo
Language/Code Page: 1033/1252
CompanyName: Acme Corporation
FileDescription: Your Sample Program
FileVersion: 1.0.0.0
InternalName: Generic Windows application
LegalCopyright: Copyright © 1999 Acme Corp. 
LegalTrademarks:
OriginalFilename: editor.exe
ProductName:
ProductVersion: 1.0.0.0
Comments:

The File Version Information after: (To see the changes made, we recommend using Resource Tuner GUI)

Child Type: StringFileInfo
Language/Code Page: 1033/1252
CompanyName: My Company
FileDescription: Yet Another Super Application
FileVersion: 5.1.4.20
InternalName: Hot product
LegalCopyright: Copyright © 2008 My Company
LegalTrademarks: your trademarks here...
OriginalFilename: editor.exe
ProductName: Super Editor
ProductVersion: 5.1.0.0
Comments: Powered by RT Console

 [Download a Demo]     [How to Get Started]

The Script Used

This script is based on the Update VersionInfo sample script. A description of the RTC script format and sample scripts can be found in the RTC Scripting Language Reference within the Resource Tuner Console package. It may be helpful to use this example as a template for your own scripts.

'----------------------------------------------------------------------------	
sub ProcessFile (Src_Path, Dest_Path, File_Name)
  LangID = 1033 ' English-US
  CP     = ScriptUnit.CodePageFromLangID(LangID)
  PEFileProxy.OpenFile Src_Path & File_Name
  if not PEFileProxy.Terminated then
    if PEFileProxy.HasResources then
      ResourcesProxy.SetLanguage LangID, DELETE_EXIST
      if ResourcesProxy.OpenVersionInfo("1", LangID, CREATE_IF_NOT_EXIST) then 
        VersionInfoProxy.SetFileVersion  5, 1, 4, 20, LangID, True, True, True
        VersionInfoProxy.SetProductVersion 5, 1, 0, 0, LangID, True, True, True

        S1 = "My Company"
        S2 = "Yet Another Super Application"
        S3 = "Hot product"
        S4 = "Copyright \0xA9 2008 My Company, Inc."
        S5 = "your trademarks here..."
        S6 = "Super Editor"
        S7 = "Powered by RT Console"

        VersionInfoProxy.EditStringFileInfo "CompanyName", S1, CP, LangID, True, True
        VersionInfoProxy.EditStringFileInfo "FileDescription", S2, CP, LangID, True, True
        VersionInfoProxy.EditStringFileInfo "InternalName", S3, CP, LangID, True, True
        VersionInfoProxy.EditStringFileInfo "LegalCopyright", S4, CP, LangID, True, True
        VersionInfoProxy.EditStringFileInfo "LegalTrademarks", S5, CP, LangID, True, True
        VersionInfoProxy.EditStringFileInfo "ProductName", S6, CP, LangID, True, True
        VersionInfoProxy.EditStringFileInfo "Comments", S7, CP, LangID, True, True

        VersionInfoProxy.EditStringFileInfo "OriginalFilename", File_Name, CP, LangID, 
True, True

        ResourcesProxy.CloseVersionInfo
        PEFileProxy.Compile
        PEFileProxy.SaveAsNewImage Dest_Path & File_Name
      else
        PEFileProxy.PostDebugString "Can't open/create Version Info..."
      end if
    end if
  end if
end sub	
'----------------------------------------------------------------------------------
'----------------------------------------------------------------------------------
'
' The main routine.
'
' First, it scans a spicified Source folder for EXE files available.
' Then, for each file found it calls for the ProcessFile procedure.
'
'----------------------------------------------------------------------------------

sub Main
  dim Src_Path, Dest_Path, File_System_Object, Folder_Object, File_Object, File_Collection
  PEFileProxy.UpdateCheckSum = True
  PEFileProxy.CreateBackUp   = False
  ' Path to Source Folder
  Src_Path = ScriptUnit.CurrentFolder & "\demo\src\"
  ' Path to Destination Folder
  Dest_Path = ScriptUnit.CurrentFolder & "\demo\release\"
  ' Scan the specified folder, and then process all files found.
  set File_System_Object = CreateObject("Scripting.FileSystemObject")
  set Folder_Object      = File_System_Object.GetFolder(src_path)
  set File_Collection    = Folder_Object.Files
  for each File_Object in File_Collection
    ProcessFile Src_Path, Dest_Path, File_Object.name
    PEFileProxy.PostDebugString   "*************************************"
  next
end sub
'----------------------------------------------------------------------------------	
	

Feature Tour  
home | next 

 


Buy NowBuy Resource Tuner Console now for US$ 199, and make resource editing easier and faster.

Download a 30 day trial version of RTC     How to Order

     

Home  •   Site Map  •   Purchase  •   Downloads  •   Support  •   F.A.Q.  •   Forum  •   About