startseite produkte
resource tuner console
beispiel-skripts
Veränderung der Zeilen und Version-Nummern
Diese Skript zeigt, wie man eine Stringtabelle ändert, indem man eine Definitionsdatei benutzt und eine neue Stringtabelle hinzufügt, eine Messagetabelle verändert, Versionsinfo-Ressourcen aktualisiert oder eine Ressourcenkopie (Messagetabelle) in einer anderer Sprache erstellt, einen Ressourcen-Baumverzeichnis in die Logdatei schreibt, gesamte Dateiressourcen als Ressourcen-DLL speichert.
Dieses Skript bearbeitet die Strings in der Demo-EXE-Datei, indem es die Werte aus der Definitionsdatei "demoapp1.drc" benutzt. Dann fügt es eine neue Stringtabelle hinzu, ändert die vorhandene Messagetabelle, aktualisiert die Versionsinformationen, und speichert die Ressourcen der gesamten Datei als Ressourcen DLL. Die resultierenden Dateien werden in den Zielordner gespeichert.
Hinweis: Wenn Sie den Script-Code kopieren, stellen Sie bitte sicher, dass er keine Zeilenumbrüche enthält. Dies ist eine Anforderung von VBScript: der gesamte Befehl muss in einer Zeile stehen.
'------------------------------------------------------------------------------ ' ' 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 a definition file ' - Add a new String Table ' - Modify a Message Table ' - Update a Version Info resource ' - Create a copy of the resource (Message Table) with another language ' - Outputs a resource tree to a log file ' - Save the entire file's resources as a resource DLL ' ' The script will modify strings in DemoApp1.exe using values from the ' definition file "DemoApp1.drc" in the "Demo\defs\" folder. ' Then it will add a new StringTable, modify the MessageTable, update the ' Version Information, save the entire file's resources as a resource DLL. ' ' The resulting files will be created in the directory named "Demo\Release" '------------------------------------------------------------------------------ Sub Main PEFileProxy.PostDebugString "Aktualisierung der Prüfsumme im PE Dateikopf ist aktiviert." PEFileProxy.UpdateCheckSum = True PEFileProxy.PostDebugString "Die Erstellung einer Sicherungskopie ist deaktiviert." PEFileProxy.CreateBackUp = False LangID = 1033 ' English-US CP = ScriptUnit.CodePageFromLangID(LangID) PEFileProxy.PostDebugString "CodePage value for English-US: " & CStr(CP) PEFileProxy.PostDebugString "Opening the file..." PEFileProxy.OpenFile ".\demo\src\DemoApp1.exe" if (PEFileProxy.Terminated) then PEFileProxy.PostDebugString "Opening the 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" PEFileProxy.PostDebugString "Editing String Table..." S1 = "My App Number1" S2 = "Resource String: Item1 was modified." S3 = "Resource String: Item2 was updated." S4 = "Resource String: Item3 was changed." S5 = "Version Info:" S6 = "&Close App" ' Gain access to an entry using definition ResourcesProxy.EditStringTable "dm1Unit_res_strFormCaption", 0, CURRENT_LANG, S1, CP ResourcesProxy.EditStringTable "dm1Unit_res_strLabel1", 0, CURRENT_LANG, S2, CP ResourcesProxy.EditStringTable "dm1Unit_res_strLabel2", 0, CURRENT_LANG, S3, CP ResourcesProxy.EditStringTable "dm1Unit_res_strLabel3", 0, CURRENT_LANG, S4, CP ResourcesProxy.EditStringTable "dm1Unit_res_strVersion", 0, CURRENT_LANG, S5, CP ' Gain access to an entry using entry index ResourcesProxy.EditStringTable "65269", 0, CURRENT_LANG, S6, CP ' Create a new String Table (English-US) S1 = "This resource has been added by RTC (English-US)" ResourcesProxy.EditStringTable "1", 1033, CREATE_IF_NOT_EXIST, S1, CP PEFileProxy.PostDebugString "Editing Message Table..." S1 = "Event 1" S2 = "Event 2" S3 = "Event 5" ResourcesProxy.EditMessageTable "1", 0, CREATE_IF_NOT_EXIST, 10001, S1, CP ResourcesProxy.EditMessageTable "1", 0, CREATE_IF_NOT_EXIST, 10002, S2, CP ResourcesProxy.EditMessageTable "1", 0, CREATE_IF_NOT_EXIST, 10005, S3, CP S1 = "Error 1" S2 = "Error 2" ResourcesProxy.EditMessageTable "1", 0, CREATE_IF_NOT_EXIST, &H80000001, S1, CP ResourcesProxy.EditMessageTable "1", 0, CREATE_IF_NOT_EXIST, &H80000002, S2, CP S0 = "InsertItem 0" S1 = "InsertItem 1" S2 = "InsertItem 2" ResourcesProxy.EditMessageTable "1", 0, CREATE_IF_NOT_EXIST, 10004, S1, CP ResourcesProxy.EditMessageTable "1", 0, CREATE_IF_NOT_EXIST, 10000, S2, CP ResourcesProxy.EditMessageTable "1", 0, CREATE_IF_NOT_EXIST, 0, S0, CP S0 = "Negative value for ID" ResourcesProxy.EditMessageTable "1", 0, CREATE_IF_NOT_EXIST, -1, S0, CP PEFileProxy.PostDebugString "Updating Version Info..." if ResourcesProxy.OpenVersionInfo("1", 0, GET_DEFAULT_IF_NOT_EXIST) then PEFileProxy.PostDebugString "Version Info opened." PEFileProxy.PostDebugString "Current FileVersion: " &_ CStr(VersionInfoProxy.FileVersionMajor) & "." &_ CStr(VersionInfoProxy.FileVersionMinor) & "." &_ CStr(VersionInfoProxy.FileVersionRelease) & "." &_ CStr(VersionInfoProxy.FileVersionBuild) PEFileProxy.PostDebugString "Current ProductVersion: " &_ CStr(VersionInfoProxy.ProductVersionMajor) & "." &_ CStr(VersionInfoProxy.ProductVersionMinor) & "." &_ CStr(VersionInfoProxy.ProductVersionRelease) & "." &_ CStr(VersionInfoProxy.ProductVersionBuild) VersionInfoProxy.SetFileVersion 2, 1, 3, 1205, 1033, True, True, True VersionInfoProxy.SetProductVersion 2, 0, 0, 0, 1033, True, True, True PEFileProxy.PostDebugString "Updated FileVersion: " &_ CStr(VersionInfoProxy.FileVersionMajor) & "." &_ CStr(VersionInfoProxy.FileVersionMinor) & "." &_ CStr(VersionInfoProxy.FileVersionRelease) & "." &_ CStr(VersionInfoProxy.FileVersionBuild) PEFileProxy.PostDebugString "Updated ProductVersion: " &_ CStr(VersionInfoProxy.ProductVersionMajor) & "." &_ CStr(VersionInfoProxy.ProductVersionMinor) & "." &_ CStr(VersionInfoProxy.ProductVersionRelease) & "." &_ CStr(VersionInfoProxy.ProductVersionBuild) VersionInfoProxy.FileFlagsMask = &H3F VersionInfoProxy.FileFlags = VS_FF_PRERELEASE or VS_FF_PRIVATEBUILD VersionInfoProxy.FileOS = VOS__WINDOWS32 VersionInfoProxy.FileType = VFT_DLL VersionInfoProxy.FileSubType = VFT2_UNKNOWN S1 = "Copyright \0xA9 2023 SuperSoftware Development" S2 = "SuperProg is a trademark of SuperSoftware Development" VersionInfoProxy.EditStringFileInfo "LegalCopyright", S1, CP, 1033, True, True VersionInfoProxy.EditStringFileInfo "LegalTrademarks", S2, CP, 1033, True, True S1 = "This has been added by the RTC test script" VersionInfoProxy.EditStringFileInfo "SpecialInfo", S1, CP, 1033, True, True PEFileProxy.PostDebugString "Closing Version Info..." ResourcesProxy.CloseVersionInfo else PEFileProxy.PostDebugString "Could not edit Version Info." end if PEFileProxy.PostDebugString "Compiling all the changes..." PEFileProxy.Compile PEFileProxy.PostDebugString "Creating a copy of the resource (Message Table) |
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.
Die komplett illustrierte Schritt für Schritt Anleitung wie man Skripte benutzt
Download 60-Tage Resource Tuner Console Testversion
Kaufen Sie die Vollversion