Should this not be a console app?

{$CONSOLE}

I think needs to be added before the Vars statement - I'm not sure this is correct though so please check in the help first.