As an alternative you could also trap the sys.executable source to check where to expect parameters to come from. I think it would something like this (using Shaun's code exampe):
import arcpy
import sys
def main(input_fc=None, output_fc=None):
# your main script body goes here
# executed as a script
if __name__ == '__main__':
if not "ArcMap" in sys.executable:
# we were passed command line parameters, execute in a script context
input_fc=sys.argv[1]
output_fc=sys.argv[2]
else:
# if we don't have args passed on the command line, assume a toolbox context
input_fc=arcpy.GetParametersAsText(0)
output_fc=arcpy.GetParametersAsText(1)
# call the main function with our parameters
main(input_fc, output_fc)
If you were to run this from an Geoprocessing Toolbox it would evaluate as 'else' and ust arcpy.GetParameter but would evaluate as "if" from another source.
Edit: I don't see any option to format the code anywhere in this ridiculous updated "forum".
Edit 2: I had to hop over tags, blogs, rss feeds, streams, and a bunch of other things that aboslutely should not be found in a tech forum and located a "how to" on formatting code blocks. The level of obscurity built into this "forum" is simply absurd.