This project is read-only.

Command line interface?

May 25, 2009 at 6:52 PM

I'm looking for a command line tool that would allow me to extract a binary resource with a single command line invocation.

I need to extract a resource as one step in a monster makefile.

Is anolis resourcer able to do this?

 

May 27, 2009 at 12:11 AM
Edited May 27, 2009 at 12:13 AM

Yes. Resourcer has command-line interface support (currently undocumented though).

Here's the syntax:

-op  : The operation to perform. Add = add, Update = upd, Extract = ext, Delete = del
-src : The file to perform the operation to. Can be an arbitrary path. The file must be writable if you're adding, updating, or deleting

-type, -name, -lang: Identifies the path to the resource data to work on.
If -lang: is missing the program will perform the operation on all children of the specified name. -lang: must be specified when adding resources.

-file: The location of the file to load into the -src: file when adding or updating. When extracting this is where the file will be saved to. If a file already exists it will be overwritten.

Anolis.Resourcer.exe -op:add -src:"C:\dest.exe" -type:TYPE -name:NAME  -lang:1033  -file:"C:\foo\icon.ico"
Anolis.Resourcer.exe -op:upd -src:"C:\dest.exe" -type:TYPE -name:NAME [-lang:1033] -file:"C:\foo\icon.ico"
Anolis.Resourcer.exe -op:ext -src:"C:\dest.exe" -type:TYPE -name:NAME  -lang:1033  -file:"C:\foo\icon.ico"
Anolis.Resourcer.exe -op:del -src:"C:\dest.exe" -type:TYPE -name:NAME [-lang:1033]

There is also a dedicated command-line program Anolis.Console, but it doesn't do anything since I decided to move the command-line functionality into the GUI Resourcer program. I'm looking into remaking Anolis.Console since a few other people have asked for a dedicated program they can use.

May 30, 2009 at 7:57 PM

I'm having a problem using it from the command line.  I always get a popup saying "Syntax error:" followed by a single 'word' of all the command line arguments run together without spaces.

The popup says there is a -batch:"file" option.  What is the syntax of the batch file?  If I run it with -batch:"XXX" then nothing happens.

I think the console version is important.  I can't really use the GUI version because it signals an error with a message box.  Every time we check in changes that causes a build 'bot' to do a new build.  We can't have that hang on a message box, and the error message needs to be in stdout ot stderr to get into a log file, an dthere needs to be an exit code for the build system to detect problems.

For build scripting it would also be useful to have a way to check if a resource name or type is present, and to list all the resources (optionally filtered by a combination of type/name/lang).  Imagine you wanted to write a .BAT file to extract all of the ICONs.  One interesting way to list would be to generate a batch file that owuld extract all the (filtered) resources.

The examples show absolute paths.  Relative paths need to work from the working directory of the command invocation otherwise it is difficult to integrate into build rules.

 

Thanks!

 

May 31, 2009 at 1:38 AM

-batch:"file" isn't implemented yet.

Can you send me the command you're using so I can repro?

I'm also working on a simple (and proper) command-line version; I'll work on it some more so it's ready for the next release in a few days time.

 

Aug 29, 2009 at 2:28 PM

I'm also getting an error like rakudrama when trying to use resourcer from the command line - while seemingly the command is right.

I'm using the latest build available for download here.

If this helps here is a screenshot of the problem: http://i184.photobucket.com/albums/x34/Drag0nR3b0rn/anolis-resourcer-cmd-error.png

Aug 29, 2009 at 5:25 PM

You need to enclose all paths in quotation marks, and you're missing out spaces between arguments.

Sep 1, 2009 at 10:45 AM

"I know - I followed your instructions in the post above & in the text file that came with the program file in the archive.

But yet I get the aforementioned error. The screenshot was taken after trying to run the following command: "Resourcer.exe -op:upd -src:"C:\Program Files\7-Zip\7z.dll" -type:ICONGROUP -name:"0" -file:"Res\7z.ico"" from the windows command prompt.

It may be relevant to note that I'm using Window 7 RC x64.

Sep 1, 2009 at 3:35 PM

Thanks for the feedback, I've investigated.

Turns out the spaces are removed by the program when it displays the error message, ignore what I said about that.

The problem is because of the way double-quote " characters are interpreted when processing command-line arguments, and the program is also displaying the wrong error message.

Anyway, the problem is you're trying to alter resource "0" rather than resource 0 (one is a string ID, the other is an integer ID) however my software interprets your "0" as 0 and not the string 0. It should display an error message saying that the resource 0 wasn't found, but it shows the syntax error message instead.

I'm working on fixing it, I'll release an update later today.