The commands you put into UI elements work mostly like you would type them into the chat window in game, except that you do not need the "/". So
OnPress="say Hello World!"
should work. Another format is this:
Code:
OnPress="say=('Hello World!') say=('Hello World!')"
The code above is always how it looks in the XML of course.
Your question #2 has many answers, most of all depending on wether you want the user to change the function in game or out of game. The easiest out-of-game solution is to tell the user how to edit your xml of course. Or you can make a separate file with only the text you want to say, <include> it into the window and reference it via the OnPress function. Best look through some existing UIs to see how it works (all .txt files in ProfitUI are <includes> for example).