Snippets

Documentation > Snippets






For all sample, you can jump to the complete $ directives...

Feel free to add you own stuff here !?

Basic snippet

Hello world sample
cmd=echo $f

MD5 stuff

All can be replaced with SHA1 or whatever.
Create md5 using wdhashcmd=echo . $O $f.$!%MD5@wdhash.wdx%$!

The result will be a file with "md5 hash" added as extension. From toto.txt a file toto.txt.b17925a0f74e68509d18f31e79c89891 will be created in the same folder !

Alternative ... you can produce a MD5 check file and use it as TCBL entry : cmd=echo $f.$!%MD5@wdhash.wdx%$! $A $1\MD5Check.lst

here $1 is a parameter passed from the command line ( it could be %T or %P from TC.)


Control md5 using wdhash and previously calculated files or check filecmd=@IF NOT $e == !%MD5@wdhash.wdx%[$x]$! @echo error for $x !

use -p as option to pause before end !
- $x is the file without extension
- $e is the extension
- $!...[$x]$! is ...wdx called with the file without extension (original file in our case)

Graphic snippet

First, you should install image magick

this tool is a fantastic image manipulation software all in command line !
ImageMagick Samples

In the folowing samples, the installation path of imagemagick is : C:\tools\graphic\ImageMagick\ ++Change with your own path !++

++CAUTION++
All command with mogrify.exe modify your file ! Do backup before trying..

[imagik.pack]
;add ImageMagik in the path
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
cmd=mogrify.exe -quality 75 $f
[imagik.RotateLeft]
;add ImageMagik in the path
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
cmd=mogrify.exe -rotate -90 $f
[imagik.RotateRight]
;add ImageMagik in the path
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
cmd=mogrify.exe -rotate 90 $f
[imagik.Half]
;add ImageMagik in the path
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
pre=set img_resize="50%"
cmd=mogrify.exe -resize "%img_resize%" $f

[imagik.thumb]
;add ImageMagik in the path
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
cmd=convert -size 100x100 $f -colors 128 -thumbnail x100  -resize "100x<" -despeckle -transparent white -sharpen 3 $x_th.gif
[imagik.toPNG]
;add ImageMagik in the path
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
cmd=convert.exe $f $x.png
[imagik.albumArt3]
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
cmd=convert $f -limit memory 1 -limit map 2 -thumbnail 300x300   -bordercolor white -border 150 -gravity center -crop 300x300+0+0 +repage -flatten -quality 75 -sharpen 3 -despeckle $x_fld.jpg
[imagik.albumArt2]
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
cmd=convert $f -limit memory 1 -limit map 2 -thumbnail 200x200   -bordercolor white -border 100 -gravity center -crop 200x200+0+0 +repage -flatten -quality 75 -sharpen 3 -despeckle $x_fld.jpg
[imagik.Shadow]
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
cmd=convert $f ( +clone -background black -shadow 75x4+3+3 ) +swap -background white -mosaic +repage $z_shadowed.$e
[imagik.polaroidCap]
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
pre=set img_resize="50%"
cmd=convert -caption "$1" $f  -thumbnail 5000x500 -bordercolor "#EFEFEF" -border 10x10   -density 144  -gravity center  -pointsize 15   -background black  -polaroid -10  -resize "%img_resize%"  -background white -mosaic +repage $p\PolaroidC_$n
[imagik.polaroid]
pre=set PATH=C:\tools\graphic\ImageMagick\;%PATH%
cmd=convert $f  -thumbnail 240x240 -bordercolor white -background black  +polaroid -background white -mosaic +repage $p\Polaroid_$n
System snippet

File listing (excel output)
Thanks to \/4D3R for the sample !
[Buttonbar]
Buttoncount=1
button1=%commander_path%\icons\menubar\tcbl\mkv.ico
cmd1=""%commander_path%\addons\tcmd\tcbld\tcbl.exe" -I "%commander_path%\.scripts\tcbl\file.ini""
param1=%L "listing" "%T\genlist.xls"
menu1=Filelist
[listing]
pre=echo off
pre=echo id   fullfilename   name   parent   gparent   ggparent   sizeB   sizeKB   sizeMB   sizeGB   datetime   ext > "$1"
cmd=echo $i
cmd=set /A myi=$i+1
cmd=echo $i   $f   $n   $p1   $p2   $p3   $!%Size@DirSizeCalc.wdx%$!   =G%myi%/1024   =G%myi%/(1024*1024)   =G%myi%/(1024*1024*1024)   $#m   $e >> "$1"
File listing csv (no exec)
[Buttonbar]
Buttoncount=1
button1=%commander_path%\icons\menubar\tcbl\mkv.ico
cmd1=""%commander_path%\addons\tcmd\tcbld\tcbl.exe" -i
param1=%L "csv_01" "%T\list.csv"
menu1=Csvlist
[csv_01]
; get output from first parameter do no exec, do not quote and keep file
ini= 1 1
ini=o $1
ini=x
ini=q
ini=k

; generate header for csv
pre=id;fullfilename;name;size KB; date time;ext
cmd=$i;"$f";"$n";$#SK;$#m;$e