OK, I modified your code a little, and got it working!

Code:
alias test {
  if ($left($1,1) == -) {
    if (d isin $1) {
      if ($isfile($mircdirtemp.log)) { 
        .remove $shortfn($mircdirtemp.log)
      } 
    }
    if (r isin $1) {
      exit
      run $mircexe
    }
  }
}