Plugin to show CBR page count as custom column

English support forum

Moderators: Stefan2, Hacker, petermad

Post Reply
wibos
New Member
New Member
Posts: 1
Joined: 2026-05-26, 19:11 UTC

Plugin to show CBR page count as custom column

Post by *wibos »

Hi,

I am looking for a way in TC to show the page count of a CBR file, as a custom column.
This is in fact a renamed RAR archive.

Currently, I have a custom column already showing the file count from a folder, and the page count from PDF files.
I would like to add the CBR page count as well.

Image: https://i.ibb.co/C3mw2KTC/2026-05-26-21h14-58.jpg

At the moment I could only find lister plugins (WLX) which can do this, but it seems these cannot be used in custom columns (WDX).
User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Plugin to show CBR page count as custom column

Post by *beb »

Had no idea what that was a CBR file.
Top google results:
https://www.reddit.com/r/explainlikeimfive/comments/1kn6yrj/eli5_what_is_a_cbr_file/
https://en.wikipedia.org/wiki/Comic_book_archive
A comic book archive or comic book reader file (also called sequential image file) is a type of archive file for the purpose of sequential viewing of images, commonly for comic books. The idea was made popular by the David Ayton...
Design
Comic book archives are not distinct file formats. They are a filename extension naming convention (renamed archive file formats listed below).
The filename extension indicates the archive type used:
.cb7 → 7z
.cba → ACE
.cbr → RAR
.cbt → TAR
.cbz → ZIP
Comic book archive files mainly consist of a series of image files with specific naming, typically PNG...
Regarding the given info, I may guestimate, that something like that can help with that:
[wdx] WinScript Advanced Content Plugin (x86\x64)
https://www.ghisler.ch/board/viewtopic.php?t=44032

Basically, we need to design a script that counts the [sequential] images in the archive (rar in that case), and passes it to the WinScript, which organizes that into a desired column field (which the plugin claims it is designed for).

In that sense, 7z l $archive (simple table-like output, good for the overview), or 7z l -slt -- $archive (itemized easy-to-parse output, e.g. "Path = App\skins\Dark Glass\separator-images.png" like entry for each file in the archive) can be the foundation for such a script, since they would happily list for us any of those archives' contents, so we can parse the output and count what is required to be counted what is counted as pages in the .cbr.

Example scripts with "7z l $archive" and "7z l -slt -- $archive" to see the raw outputs for the start:
  • 7zip_list_archive_raw_table.ps1

    Code: Select all

    $time = [diagnostics.stopwatch]::StartNew()
    
    # binary
    $env:Path +=";$env:commander_path\Plugins\app\7zip"
    
    # files to process
    $type = '.zip','.7z','.rar','.tar'
    $files = Get-ChildItem -file -force -recurse|Where {$_.Extension -in $type}
    foreach ($file in $files){
    [IO.Path]::GetRelativePath($PSScriptRoot,$file.FullName)|Write-Host -f Cyan
    '7z l $file raw list : table'|Write-Host -f Yellow
    7z l $file
    }
    
    # finalize
    $time.Stop()
    '{0} files processed for {1:mm\:ss\.fff} by {2}' -f $files.count,$time.Elapsed,
    $MyInvocation.MyCommand.Name|Write-Host -f DarkCyan
    sleep -s 33
    
  • 7zip_list_archive_raw_slt_itemized.ps1

    Code: Select all

    $time = [diagnostics.stopwatch]::StartNew()
    
    # binary
    $env:Path +=";$env:commander_path\Plugins\app\7zip"
    
    # files to process
    $type = '.zip','.7z','.rar','.tar'
    
    $files = Get-ChildItem -file -force -recurse|Where {$_.Extension -in $type}
    
    foreach ($file in $files){
    [IO.Path]::GetRelativePath($PSScriptRoot,$file.FullName)|Write-Host -f Cyan
    
    '7z l -slt -- $file : itemized'|Write-Host -f Yellow
    7z l -slt -- $file
    
    }
    
    # finalize
    $time.Stop()
    '{0} files processed for {1:mm\:ss\.fff} by {2}' -f $files.count,$time.Elapsed,
    $MyInvocation.MyCommand.Name|Write-Host -f DarkCyan
    sleep -s 33
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
User avatar
beb
Power Member
Power Member
Posts: 762
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: Plugin to show CBR page count as custom column

Post by *beb »

Here's a minimalistic working solution:
  1. Install [wdx] WinScript Content Plugin
  2. Put the plugin's ini as follows:
    options.ini

    Code: Select all

    [Script] 
    ActiveScripts=ComicBookPageCount
    
    [ComicBookPageCount]
    Script=ComicBookPageCount.ps1
    content=ComicBookPageCount
    extensions=cb7|cba|cbr|cbt|cbz
    FoldersPaths=0
    
  3. Put the ComicBookPageCount.ps1 script into the plugin's "Scripts" subfolder:
    ComicBookPageCount.ps1

    Code: Select all

    # 7-zip binary
    $env:Path += ";$env:commander_path\Plugins\app\7zip"
    
    # file formats to count as ComicBook pages
    $pageFormats = 'png|jpg|gif|bmp'
    
    # get paths array from archive
    $paths = & 7z l -slt $filename 2>&1|where {$_ -match '^Path = .+$'}
    
    # iterate paths array and collect pages
    $pages = foreach ($path in $paths){
    if ($path -match "[.]($pageFormats)$"){
        $path
        }
    }
    
    # get ComicBook PageCount field
    $content = $pages.count
    
    Notes:
    • change the path to the 7z.exe in the script according to your machine's actual environment
    • change the suggested file formats to be counted as ComicBook pages ('png|jpg|gif|bmp') to the actual formats to be counted as such
  4. Restart Total Commander
  5. Add the [=winscriptsadv.ComicBookPageCount] entry to your custom columns view (available via the TC custom columns view GUI)
Here's a ready-to-go plugin's repack, I've made for you for quick testing (reuploaded: 'gif' format added to $pageFormats = 'png|jpg|gif|bmp'):
https://www.upload.ee/files/19391213/wdx_WinScriptAdv_1.7_ComicBookPageCount_ReadyToGoRepack.zip.html

I tested that for the .cb7 (7z), .cbr (rar), .cbt (tar), and .cbz (zip) archives.
#278521 User License
Total Commander [always the latest version, including beta] x86/x64 on Win10 x64/Windows 11/Android 17
Post Reply