Archive Buttons to Create CB7 Comic/Manga in One Step

There are three different small sets of code here. They all do the same thing, just a little differently for certain cases or preferences. (read below above each set of code for description differences)

They will take selected folders containing images, compress each into a separate .7z archives. The archive is set to max compression, non-solid (to prevent long loading times on large archives), and uses LZMA2 to take advantage of multi-threads/cores. The files are automatically renamed to the .cb7 extension as well upon successful compression.

An example:

Input:
Comic 001
Comic 002
Comic 003

Output:
Comic 001.cb7
Comic 002.cb7
Comic 003.cb7

I use cdisplayex and it's windows explorer shell extension, and .cb7 thumbnails work with this method. Google and install with defaults, then clear your thumb cache if you want comic thumbnails in Windows explorer and Directory Opus for .cb7.

Note: To get this to work you WILL need 7-zip installed. I use the 9.25 alpha version from 7-zip.org . You must have 7-zip installed in order to compress using LZMA2 and take advantage of muti-threading, which will greatly speed up the compression.

To use any of the code below, just create your own button, change the function to MS-DOS command mode, then paste the code below for that button.

All three buttons take whatever is selected via check-box mode or ctrl+shift and compress them. This allows you to select only what you want to compress.

For this first button, a minimized command prompt window will run showing the process. It will stay minimized threw-out the entire process, so it will not get in the way of your work. Once the compression is completed, the window will automatically close and disappear, indicating that compression is completed. You can pull the window up to see detailed information on which archive/file it is working on while the compression is still actively ongoing.

@runmode:min
"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA2 -ms=off -mx9 -mmt4 "{file}.cb7" "{file}" 

The next code will run in hidden mode. It will display NO status updates what so ever as to what it is doing, or when it completes. This might be handy for some, or when running the task on a limited number of folders. However, you will not know if the process has finished, until you see that all your files are indeed compressed so this method might need some double-checking of work.

@runmode:hide
"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA2 -ms=off -mx9 -mmt4 "{file}.cb7" "{file}"

This last one will run via 7zG.exe, 7-zip's own built in GUI. It will display the 7-zip progress window while running the task. While this may seem nice at first, there is still no way to make this run in the background. What this means once an archive finishes and another one starts, the 7zG window will steal focus from other applications and pop up. This is very annoying, but in come cases you may want to use this if you are sitting across the room and want to periodically glance at the screen for a status update. This is not an issue with the code itself, but with 7-zip. There is no way to get 7zG to run in background mode. See this thread on SourceForge for more details.

@runmode:hide
"C:\Program Files\7-Zip\7zG.exe" a -m0=LZMA2 -ms=off -mx9 -mmt4 "{file}.cb7" "{file}"

Note that the program destination for 7-zip needs to be exact. Depending on which you have installed, the program might be under C:/Program Files (x86). Make note of which you have installed. 64 bit versions should run just fine with the provided code.

Also, depending on your processor, you may want to adjust the "-mmt4" option. Since my laptop is a dual core with hyper-threading, or 4 threads, I set this to 4. Dual cores would want 2, and a desktop i7-4770k would want to have it set to 8. This will speed up the process and take advantage of all your cores/threads. So make sure to set it. If you don't know what to set it to, pull up task manager and go to the performance tab. The number of CPU graphs is how many threads you have. Windows 8 won't show this by default, so right click your graph and make sure to set "Change graph to: Logical Processors".

These three buttons work perfectly for me, running Windows 7 SP1 x64, using Directory Opus 11.1 x64.