To run code in a greeting there are 2 options, use a Template, or use a redirect.
For example, for a Template you can use something like:
Template("{var hour = Date.get(Date.date(), #hour); if (hour < 10) { "Good morning." } else if (hour > 18) { "Good evening." } else { "Good day." } }")
For a redirect, you use a Template in your greeting that does a redirect to a response that is handled by a script.
Template("{ redirect("script_greeting") }")