Determine $APPNAME programmatically.