'------------------------------------------------------------------------------ ' ' RTC http://www.heaventools.com ' ' 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 batch process the contents of a directory in order to update the Version ' Info properties on existing EXE and DLL files. ' ' Note: Some Anti-Virus programs may alert you about malicious script ' detected. Please ignore this alert. ' ' Resource Tuner Console Demo allows you to process only two files at a time. ' Order the full version and enjoy it without limitations! ' '---------------------------------------------------------------------------- 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 and DLL files available. ' Then, for each file with specific file extension (EXE and DLL) ' 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 & "src\" ' Path to Destination Folder Dest_Path = ScriptUnit.CurrentFolder & "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 ' Get an extension and modify it to one uniform lower case ' because there may be both upper and lower case characters FL_EXT = LCase(File_System_Object.GetExtensionName(File_Object.name)) ' Check an extension and process specific file extension If FL_EXT = "exe" or FL_EXT = "dll" then ProcessFile Src_Path, Dest_Path, File_Object.name PEFileProxy.PostDebugString "*************************************" End If next end sub '------------------------------------------------------------------------------ |