; /drawpbar [-prbofmdNcNtN] @ x y w h min max val bar-color [bg-color] [outline-color] [top-shade-color bottom-shade-color] [marginx marginy] [B gap-width] [font size color [text]] ; -> Flags: ; ---> -p : Specified top/bottom shade colors ; ---> -r : Colors specified are in RGB format ; ---> -b : Background color specified ; ---> -o : Outline color specified ; ---> -m : X and Y margins specified ; ---> -dN : Percentage will be rounded to the Nth decimal ; ---> -cN : Divide the progress bar into B amount of bars ; ------> N (1-2) = 1: Keep full 100% bar into B bars, designate bar accordingly - 2: Divide bar into B bars ; ---> -tN : Text is to be displayed on the bar (Percentage, or specified text) ; ------> N (1-5) = 1: Left - 2: MidBar - 3: Middle - 4: RightBar - 5: Right ; ---> -f : Process control codes in the text provided (must be with flag -tN) ; ---> -s : Bold the text provided/percentage written ; Type /pbartest to see some examples and what they come out to. alias drawpbar { var %f = $iif(-* iswm $1,$1), %p = $iif(%f,$2-,$1-), %d = $iif($regex(%f,(d\d)),$regml(1),0), %er if (b isin %f) var %b = $11, %p = $deltok(%p,10,32) if (o isin %f) var %o = $gettok(%p,10,32), %: = 1, %; = 2, %p = $deltok(%p,10,32) if (p isin %f) var %ts = $gettok(%p,10,32), %bs = $gettok(%p,11,32), %p = $deltok(%p,10-11,32) if (m isin %f) var %mx = $gettok(%p,10,32), %my = $gettok(%p,11,32), %p = $deltok(%p,10-11,32) if (c isin %f) var %c = $gettok(%p,10,32), %g = $gettok(%p,11,32), %. = $iif($regex(%f,(c\d)),$regml(1),c1), %p = $deltok(%p,10-11,32) tokenize 32 %p var %v = $iif($8 > $calc($7 - $6),$v2,$8), %len = $round($calc(%v * (($4 - (2* %mx)) / ($7 - $6))),0), %xy = $calc($2 + %: + %mx) $calc($3 + %: + %my), %c = $iif(%c,%c,1), %l = $round($calc(($iif(1 isin %.,$calc($4 - %mx *2),%len) - %; - %g * (%c -1)) / %c),0) if (!$window($1)) %er = invalid window elseif ($6 > $7) %er = max must be greater than min elseif ($calc($4 - (%mx *2)) <= 0) && (m isin %f) %er = x margin value too high elseif ($calc($5 - (%my *2)) <= 0) && (m isin %f) %er = y margin value too high elseif (f isin %f) && (t !isin %f) %er = -tN flag must be provided with the -f flag if (%er) goto e if (%o != $null) drawrect $iif(r isin %f,-r) $1 $^(%o,%f) 1 $2-5 if (%b) drawrect $iif(r isin %f,-fr,-f) $1 $^(%b,%f) 1 $calc($2 + %:) $calc($3 + %:) $calc($4 - %;) $calc($5 - %;) if (%len >= 2) { var %x = 0 while (%x < %c) { var %< = $iif($calc(%len - (%l + %g) * %x) < %l,$v1,%l), %> = $calc($2 + %: + %mx + ((%l + %g) * %x)) drawrect $iif(r isin %f,-fr,-f) $1 $^($9,%f) 1 %> $calc($3 + %: + %my) %< $calc($5 - %; - (2 * %my)) if (p isin %f) { drawline $iif(r isin %f,-r) $1 $^(%ts,%f) 1 %> $calc($3 + $5 - %; - %my) %> $calc($3 + %: + %my) $calc(%< + %> + %:) $calc($3 + %: + %my) drawline $iif(r isin %f,-r) $1 $^(%bs,%f) 1 %> $calc($3 + $5 - %; - %my) $calc(%< + %>) $calc($3 + $5 - %; - %my) $calc(%< + %>) $calc($3 + %: + %my) } inc %x $iif(%< < %l,%c) } } if (t isin %f) { var %tn = $remove($iif($regex(%f,(t\d)),$regml(1),1),t), %t = $iif($13,$13-,$round($calc((%v / ($7 - $6)) * 100),$remove(%d,d)) $+ $chr(37)), %y = $calc($3 + ($5 /2) - ($height(%t,$10,$11) /2)) if (%tn < 2) drawtext $+(-,$iif(r isin %f,r),$iif(f isin %f,p), $iif(s isin %f,o)) $1 $^($12,%f) $10-11 $calc($2 + %; + %mx + 1) %y %t else drawcent $+(-,$iif(r isin %f,r),$iif(%tn isnum 4-5,x),$iif(f isin %f,p),$iif(s isin %f,o)) $1 $^($12,%f) $10-11 $calc($2 + %: + %mx) $3 $iif($istok(2 4,%tn,32),%len,$calc($4 - %mx - %:)) $5 %t } :e if (%er) echo -a * /drawpbar: %er } alias -l drawcent { var %f = $iif(-* iswm $1,$1), %c = $iif(f isin %f,$4), %r = $iif(x isin %f,1,2) tokenize 32 $iif(%f,$iif(f isin %f,$2-3 $5-,$2-),$1-) var %x = $calc($5 + ($7 / %r) - ($width($iif(o isin %f,) $+ $9-,$3,$4) / %r) - $iif(%r < 2,2)), %y = $calc($6 + ($8 /2) - ($height($iif(o isin %f,) $+ $9-,$3,$4) /2)) if (f isin %f) drawrect -f $1 %c 1 $5-8 drawtext $remove(%f,f,x) $1-4 $iif(%x < $5,$5,%x) %y $9- } alias -l ^ return $iif($chr(44) isin $1 && r isin $2,$rgb( [ $1 ] ),$1) alias pbartest { window -p @pbartest 0 0 580 237 drawrect -fr @pbartest 16777215 1 0 0 580 210 var %1, %2, %3, %4, %5 %1 = /drawpbar -prt3bsd2c1om @pbartest 10 25 100 20 0 100000 $r(0,100000) $rgb(0,180,0) $rgb(208,208,208) $rgb(0,180,0) $rgb(0,255,0) $rgb(0,128,0) 10 3 4 3 tahoma 8 0 %2 = /drawpbar -prt3bo @pbartest 10 65 80 18 0 1000 $r(0,1000) 0,0,0 255,255,255 0,0,0 208,208,208 128,128,128 tahoma 9 0,0,255 %3 = /drawpbar -prt4bd1o @pbartest 10 103 140 28 0 1000 $r(0,1000) $rgb(180,0,0) $rgb(255,255,0) $rgb(180,0,0) $rgb(255,0,0) $rgb(128,0,0) tahoma 12 $rgb(0,0,0) %4 = /drawpbar -prbc1o @pbartest 10 150 60 14 0 1000 $r(0,1000) 0,0,180 144,144,144 0,0,180 0,0,255 0,0,128 4 2 %5 = /drawpbar -bt1 @pbartest 10 185 100 16 0 100 $r(0,100) 2 4 verdana 8 0 Loading... drawtext -r @pbartest 0 tahoma 10 10 8 1. %1 drawtext -r @pbartest 0 tahoma 10 10 48 2. %2 drawtext -r @pbartest 0 tahoma 10 10 86 3. %3 drawtext -r @pbartest 0 tahoma 10 10 133 4. %4 drawtext -r @pbartest 0 tahoma 10 10 168 5. %5 %1 %2 %3 %4 %5 }