Jump to content

ResHack command line option


Recommended Posts

Hi,

I'm using Aut2Exe.exe to compile my script with the command line and now i would like to use reshack (like scite) to change version, comment and so one ...

Is there a way to start reshack via the command line and give it the information i want to change via parameters ?

Link to comment
Share on other sites

there comes a help file with reshacker

Command Line Scripting:

All the functionality of the Resource Hacker GUI (apart from viewing resources) can be accessed from the command line without having to open Resource Hacker. Command line scripting can remove the drudgery entailed with repetitive Resource Hacker tasks.

Command line scripts have 2 general forms:

1. Single commands:

ResHacker.exe command command_parameters

2. Multiple commands:

ResHacker.exe -script scriptfile

Single Commands:

command and command_parameters:

-add ExeFile, SaveAsFile, ResourceFile, ResourceMask

-addskip ExeFile, SaveAsFile, ResourceFile, ResourceMask

-addoverwrite ExeFile, SaveAsFile, ResourceFile, ResourceMask

-modify ExeFile, SaveAsFile, ResourceFile, ResourceMask

-extract ExeFile, ResourceFile, ResourceMask

-delete ExeFile, SaveAsFile, ResourceMask

Each command parameter must be separated by a comma, but no comma is expected before the first parameter.

If paths are not included with filenames, then the operating systems current folder is presumed to contain the named file. It is generally good practice, though not required here, to enclose filenames containing spaces within double quotes.

The ResourceMask enables a command to be performed on either single or multiple resource items and takes the form ResType,ResName,ResLang. If ResType is a predefined type, then either its number or identifier can be used e.g. the ResourceMask dialog,128,0 is identical to 5,128,0. Any or all of the ResourceMask items can be omitted e.g. dialog,, indicates that all dialogs are to be applied to the command irrespective of name or language, and ,,1049 indicates that all resources with Russian (1049) as the languageID will be applied to the command. An empty ResourceMask ,, indicates that the command will be applied to every resource irrespective of type, name or language.

When adding or modifying items, the ResourceFile can be a RES file for any item type, a BMP file for BITMAP types, a CUR file for CURSORGROUP types, an ICO file for ICONGROUP types, and any file type for RCDATA and user defined resource types.

When adding and modifying resources from files other than RES files then both ResType and ResName must be specified in the ResourceMask. If ResLang is omitted then the command applies to the first language item with matching type and name, otherwise, if no matching item exists then language neutral (0) is assumed.

When extracting resources, and more than one item is implied by the ResourceMask, then the specified ResourceFile must be either a RES file or an RC file. When binary image resources are extracted to RC files, each image is also created as a separate binary (ICO, CUR, BMP, GIF, BIN) file. See the example below.

ICON and CURSOR resources cannot be manipulated directly but are added, deleted, modified and extracted by using their respective ICONGROUP or CURSORGROUP. ICON and CURSOR can still be used but Resource Hacker will assume ICONGROUP or CURSORGROUP was intended.

Borlands DFM files can also be added irrespective of whether the file is in binary or text format. However, they will always be extracted in text format (To convert text-formatted dfm files to binary format, use Borlands utility Convert.exe).

All actions or errors are logged to ResHacker.log.

NB: If a script does not produce the desired results then check the log!

Examples: (File paths have been omitted for clarity)

To add or update dialog name:maindlg lang:0 in MyProg.exe from UpdDlg.res

ResHacker.exe -addoverwrite MyProg.exe, MyProgNew.exe, UpdDlg.res, dialog,maindlg,0

To add or update bitmap name:128 in MyProg.exe from NewImage.bmp

ResHacker.exe -addoverwrite MyProg.exe, MyProgNew.exe, NewImage.bmp , bitmap,128,

To add or update all bitmaps in MyProg.exe from Images.res

ResHacker.exe -addoverwrite MyProg.exe, MyProgNew.exe, Images.res, bitmap,,

To add a user-defined binary resource (README,1,0) to MyProg.exe from ReadMe.html

ResHacker.exe -addoverwrite MyProg.exe, MyProgNew.exe, ReadMe.html, readme,1,0

To add all items in Images.res to MyProg.exe (but fail if any item already exists)

ResHacker.exe -add MyProg.exe, MyProgNew.exe, Images.res ,,,

To add all items in Images.res to MyProg.exe (skipping any existing items)

ResHacker.exe -addskip MyProg.exe, MyProgNew.exe, Images.res ,,,

To modify all items in MyProg.exe with the items in Images.res (ignoring any items in Images.res which do not exist in MyProg.exe)

ResHacker.exe -modify MyProg.exe, MyProgNew.exe, Images.res , , ,

To extract all icons from MyProg.exe to MyProgIcons.rc (creating MyProgIcons.rc, Icon_1.ico, Icon_2.ico , Icon_3.ico etc...)

ResHacker.exe -extract MyProg.exe, MyProgIcons.rc, icongroup,,

To delete GIF name:128 from MyProg.exe

ResHacker.exe -delete MyProg.exe, MyProgNew.exe, gif,128,

Multiple Commands:

syntax: ResHacker.exe -script ScriptFile

ScriptFile is a text file with the following layout:

//comments are preceded by double slashes

[FILENAMES]

Exe=

SaveAs=

Log=

[COMMANDS]

-add ResourceSrc, ResourceMask

-addskip ResourceSrc, ResourceMask

-addoverwrite ResourceSrc, ResourceMask

-addoverwrite ResourceSrc, ResourceMask

-modify ResourceSrc, ResourceMask

-extract ResourceTgt, ResourceMask

-delete ResourceMask

If Log is omitted then the default log ResHacker.log will be used.

NB: If a script does not produce the desired results then check the log!

Examples:

rh_script_myprog_rus.txt -

//This script deletes all Language Neutral (0)

//string-table, menu and dialog resource items

//in MyProg.exe before replacing them

//with Russian (1049) items...

[FILENAMES]

Exe= MyProg.exe

SaveAs= MyProg_Rus.exe

Log= MyProg_Rus.log

[COMMANDS]

-delete MENU,,0

-delete DIALOG,,0

-delete STRINGTABLE,,0

-add MyProg_Rus.res, MENU,,1049

-add MyProg_Rus.res, DIALOG,,1049

-add MyProg_Rus.res, STRINGTABLE,,1049

rh_script_myprog_upd_images.txt -

//This script updates 2 bitmaps and an

//icon in MyProg.exe ...

[FILENAMES]

Exe= MyProg.exe

SaveAs= MyProg_Updated.exe

[COMMANDS]

-addoverwrite Bitmap128.bmp, BITMAP,128,

-addoverwrite Bitmap129.bmp, BITMAP,129,0

-addoverwrite MainIcon.ico, ICONGROUP,MAINICON,0

rh_script_myprog_upd_all.txt -

//This script replaces all resources

//in MyProg.exe with all the resources

//in MyProgNew.res

[FILENAMES]

Exe= MyProg.exe

SaveAs= MyProg_Updated.exe

[COMMANDS]

-delete ,,, //delete all resources before...

-add MyProgNew.res ,,, //adding all the new resources

Link to comment
Share on other sites

  • Developers

Why not use AutoIt3Wrapper, which is included in SciTE4AutoIT3 but can also be used separately when you prefer a different Editor ?

Edited by JdeB

SciTE4AutoIt3 Full installer Download page Ā  -Ā Beta filesĀ  Ā  Ā  Ā Read before postingĀ  Ā  Ā How to post scriptsourceĀ Ā Ā Forum etiquetteĀ  Forum RulesĀ 
Ā 
Live for the present,
Dream of the future,
Learn from the past.
Ā  :)

Link to comment
Share on other sites

  • 5 years later...

ResHacker.exe -addoverwrite a.exe, b.exe, c.res, versionInfo,1,

you're overwriting the a.exe version with the version 1 from c.res, te c.res really have the versionInfo?

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there'sĀ InetReadĀ and WinHTTP, way better
happy.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...