All pastes #763773 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-06 19:00 UTC
rendered paste body
3BPBar--Created By Foshizzle

;demo
alias progbartest {
  window -pkodCf @progress -1 -1 302 28
  drawpbar -lp @progress 1 1 300 25 10990003
}

;:;:;:;
;engine

alias drawpbar {
  if ($1-) {
    $iif(-* iswm $1, set %switch $1, set %switch $null)
    $iif($iif(%switch == $null, $1, $2), set %pbarwin $iif(%switch == $null, $1, $2), goto err)
    $iif($iif(%switch == $null, $2, $3), set %x $iif(%switch == $null, $2, $3), goto err)
    $iif($iif(%switch == $null, $3, $4), set %y $iif(%switch == $null, $3, $4), goto err)
    $iif($iif(%switch == $null, $4, $5), set %w $iif(%switch == $null, $4, $5), goto err)
    $iif($iif(%switch == $null, $5, $6), set %h $iif(%switch == $null, $5, $6), goto err)
    $iif($iif(%switch == $null, $6, $7), set %c $iif(%switch == $null, $6, $7), goto err)
    set %prcnt 0
    set %inc.x $calc(%w / 100)
    set %lo 0
    contload
  }
}
alias -l contload {
  if (%prcnt <= 100) && ($window(%pbarwin, *)) {
    drawrect -nrf %pbarwin $rgb(235,235,235) 1 %x %y %w %h
    drawrect -nrf %pbarwin $rgb(245,245,245) 1 %x %y %w $calc(%h / 3)
    drawrect -nrf %pbarwin $rgb(%c) 1 %x %y %lo %h
    drawrect -nrf %pbarwin $rgb($calc(%c + 15)) 1 %x %y %lo $calc(%h / 3)
    drawrect -nr %pbarwin $rgb(40,40,40) 1 %x %y %w %h
    $iif(*l* iswm %switch, drawtext -n %pbarwin 1 tahoma 10 $calc(%x + 5) $calc(%y + (%h / 2) - 5) Loading $+ $str(.,$and(3,%prcnt)), $null)
    $iif(*p* iswm %switch, drawtext -n %pbarwin 1 tahoma 10 $calc(%w / 2) $calc(%y + (%h / 2) - 5) %prcnt $+ %, $null)
    inc %prcnt
    inc %lo %inc.x
    $iif(%pbarwin, drawrect %pbarwin, halt)
    $iif(%pbarwin, .timer -m 1 30 contload, halt)
  }
  elseif (%prcnt > 100) { window -c %pbarwin | unset %pbarwin | unset %w | unset %h | unset %prcnt | unset %inc.x | unset %lo | unset %switch | unset %x | unset %y | unset %c }
}