Free Trial Software Downloads Command-line Resource Editor
Heaventools Home
 

home      products      solutions     news     downloads     order     support     about us

 

 
Resource Tuner Console Sample Scripts
 

 

Update Version Info

Update The Version Information

This sample VBScript code provides a real-world example that demonstrates many of the features available in Resource Tuner Console. This code shows how to change version variables (version numbers, product name, copyright strings, etc) from the command line.

The script allow modification of file version information on existing Windows EXE or DLL files in a folder. If a file contains no Version Info resource, Resource Tuner Console will create this resource for you. Every field in the VERSIONINFO structure is under your control.

'----------------------------------------------------------------------------	
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_IF_EXISTS
      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 2007 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
'----------------------------------------------------------------------------------	
	

To see the changes made to the test EXEs, we recommend using Resource Tuner GUI, a visual resource editor.

Start tuning your applications now

Resource Tuner Console offers exceptional value for money and delivers functionality that reaches far beyond its price tag. Discover how you and your organization can benefit from this exciting program. Start tuning your applications today!

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

Download a 30 day trial version of ResTuner     How to Order

     

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