Heaventools

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

startseite   produkte   resource tuner console   beispiel-skripts

Edit Strings: Verändern der String-Table

Dieser Script zeigt an, wie man eine Zeichenfolge-Tabelle und Message-Tabelle verändert, indem er die Werte von externer Unicode-Textdatei benutzt.

 

The script edits the strings in the demo EXE (which shipped with the RTC package) using values from the definition file. It modifies the StringTable entries and adds a new MessageTable using the external Unicode text files "strings.txt" and "messages.txt". The modifed file is saved to the Destination folder.

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 sample VBScript code provides a real-world example that demonstrates
' many of the features available in Resource Tuner Console. 
'
' This code shows how to: 
' - Modify a String Table using values from an external unicode text file.     
' - Add a Message Table using values from an external unicode text file.
'
' The script will modify strings in demoapp1.exe using values from:
' - definition file "demoapp1.drc" in the "Demo\defs\" folder
' - unicode text file "strings.txt" in the "Demo\Src" folder
' - unicode text file "messages.txt" in the "Demo\Src" folder  
'
' The resulting files will be created in the directory named "..\Demo\Release" 
'
'
'------------------------------------------------------------------------------

Sub Main
  PEFileProxy.PostDebugString "Updating the checksum in the PE file header is enabled." 
  PEFileProxy.UpdateCheckSum = True 

  PEFileProxy.PostDebugString "The creation of a backup copy is disabled." 
  PEFileProxy.CreateBackUp = False 

  PEFileProxy.PostDebugString "Opening a file..."
  PEFileProxy.OpenFile ".\demo\src\demoapp1.exe"
  if (PEFileProxy.Terminated) then
    PEFileProxy.PostDebugString "Opening a file produced a fatal error."
  else
    PEFileProxy.PostDebugString "File successfully opened."
    if (not PEFileProxy.HasResources) then
      PEFileProxy.PostDebugString "The file contains no resources."
    else
      PEFileProxy.PostDebugString "The file contains resources."

      PEFileProxy.ClearDefinitions
      PEFileProxy.PostDebugString "Opening a definition file..."
      PEFileProxy.OpenDefinitionFile ".\demo\defs\demoapp1.drc"

      LangID = 0 ' Default

      PEFileProxy.PostDebugString "Editing String Table using TXT file..."
      ResourcesProxy.EditStringTableFromFileW  LangID, CREATE_IF_NOT_EXIST,
".\demo\src\strings.txt"

      PEFileProxy.PostDebugString "Adding a New Message Table using TXT file"
      ResourcesProxy.EditMessageTableFromFileW  "1", LangID, CREATE_IF_NOT_EXIST,
".\demo\src\messages.txt"

      PEFileProxy.PostDebugString "Compiling all changes..."
      PEFileProxy.Compile

      PEFileProxy.PostDebugString "Saving file as a new file..."
      PEFileProxy.SaveAsNewImage ".\demo\release\demoapp1.exe"
    end if
    PEFileProxy.PostDebugString "Closing this file..."
    PEFileProxy.CloseFile
  end if
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 Step by Step Guide To Using Scripts

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