The script would need to check if the input file is supplied as an argument. If it is not, then assume that input is piped. The first command in the script that uses stdin must then process the pipe, e.g...
[tt]
if [[ ! $File ]]
then
File=/tmp/file$$
cat > $File #---this is being piped into
fi[/tt]