Heaventools

   English English  Deutsch Deutsch  Русский Русский

startseite   produkte   resource tuner console   beispiel-skripts

Stapelverarbeitung von alle Dateien in einem Verzeichnis

Dieser Script zeigt, wie man die Inhalte des Verzeichnisses stapelweise verarbeitet.

RTC ScriptThe script scans the specified Source directory for all files available. Then, for each file with given file extension (EXE, DLL, SYS, CPL) it calls for the ProcessFile procedure to set the English-US language for all of the resources in the file and update the Version Information. The resulted files are saved to the Destination directory.


Note: when copying out the script code, please make sure there's no line breaks. This is a requirement of VBScript: the entire command must be on one line.

'------------------------------------------------------------------------------
'
' This code shows how to batch process the contents of a directory.
' It processes specific file extensions (EXE, DLL, SYS, CPL) in the source directory.
'
'------------------------------------------------------------------------------
'----------------------------------------------------------------------------
' ProcessFile
' 
' Purpose:
' 
' Processes a file: it sets the English-US language for all of the resources
' in the file, and modifies/adds a Version Information resource.
'----------------------------------------------------------------------------

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  2, 0, 1, 122, LangID, True, True, True
        VersionInfoProxy.SetProductVersion 2, 0, 0, 0, LangID, True, True, True
        S1 = "Copyright \0xA9 1994-2099 SuperSoftware Development" 
        S2 = "SuperProg is a trademark of SuperSoftware Development" 
        S3 = "This file modified by Resource Tuner Console" 
        VersionInfoProxy.EditStringFileInfo "LegalCopyright", S1, CP, LangID, True, True
        VersionInfoProxy.EditStringFileInfo "LegalTrademarks", S2, CP, LangID, True, True
        VersionInfoProxy.EditStringFileInfo "Comments", S3, 1049, LangID, True, True
        ResourcesProxy.CloseVersionInfo 
        PEFileProxy.Compile 
        PEFileProxy.SaveAsNewImage Dest_Path & File_Name 
      Else 
        PEFileProxy.PostDebugString "Failed to open/create Version Info..." 
      End If 
    End If 
  End If 
End Sub 
'------------------------------------------------------------------------------ 

'------------------------------------------------------------------------------ 
' 
' The main routine. 
' 
' First, it scans the specified Source folder for 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
  ' Specify the path to the Source Folder
  Src_Path = ScriptUnit.CurrentFolder & "src\"
  ' Specify the path to the 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" or FL_EXT = "sys" or FL_EXT = "cpl" then
      ProcessFile Src_Path, Dest_Path, File_Object.name
      PEFileProxy.PostDebugString "*************************************"
    End If
  Next 
End Sub
'------------------------------------------------------------------------------

Um die Änderungen, die man in Test-EXE-Dateien gemacht hat, zu sehen, empfehlen wir die Benutzung von Resource Tuner GUI, einem visuellen Ressourcen-Editor.

Nachdem Sie Resource Tuner Console installiert haben, finden Sie die Beispiel-Skripts in dem Verzeichnis, in dem RTC installiert wurde. Das Setup-Programm erstellt auch das Verzeichnis "Demo" im RTC-Verzeichnis, der Testanwendungen im Unterverzeichnis "Demo\Src" enthält.

 

So verwenden Sie die Skripts: The Complete Illustrated Guide To Using Scripts

Download 60-Tage Resource Tuner Console Testversion     Kaufen Sie die Vollversion