You're doing it wrong.

First, what's with -pn switches? Use either Normal (-n) or Photo (-p).

And, you're send an extra parameter to /background here
Code:
background -pn %n $qt($+($scriptdir,$1,.png))

What's %n? You don't need it there.

Code:
alias bg {
  if (!$1) { return }
  var %n = $1
  tokenize 32 $mkfn($1)
  var %file = $qt($+($scriptdir,$1,.png))

  window -pdCk0arh +eLf @logo -1 -1 840 90
  drawtext -o @logo 01 Tahoma 60 20 7 $iif($len(%n) >= 22,$+($mid(%n,1,22),...),%n)
  drawtext -o @logo 04 Tahoma 60 20 5 $iif($len(%n) >= 22,$+($mid(%n,1,22),...),%n)

  drawsave -b32 @logo %file
  window -c @logo

  background -an %file
  .timer 1 0 .remove %file
}


It's good to use a timer (even with duration 0) for removing the file, just to make sure that it will be removed after the code reaches the end.


Nothing...