Make a custom alias and use that with /play -a.
/play -a shortplay chan myhugefile.txt 1500
alias shortplay {
inc %shortplay
set -u10 %shortplay %shortplay
if (%shortplay < 5) { msg chan $1- }
else {
unset %shortplay
play stop
}
}
That's just a quick example and could probably be improved. It's just to give you an idea.
Note that the set -u10 line is there just to prevent the variable from staying set if you play a file with under 5 lines.