Develop Program with 'None Interactive Flag'

Hi I have created a program but am currently wondering how to develop it further. I wanted to know how i would go about developing the program further so that it is able to run with a "none interactive flag" enabling execution to be automated with the resultant file e-mailed to a user once a week.

I can include the code for the program if this would help, all help is much appreciated. Thanks

I've jsut done something similar where you run a script and dependant if its ran from cron (i.e automated) or a shell it either emails the output or just prints to screen.

There are various ways to do it each with their own caveats, but i chose to use $TERM.

e.g

#!/bin/ksh

.... loads of script stuff....

if [[ -n "${TERM}" ]];then
    print "\n****** WE are running INTERACTIVE mode. ******\n"
    ....do stuff here if ran from shell....
else
    ....do stuff here if not. Therefore ran from cron or none shell
fi