I think I may have cracked it. Just to be clear, I am using a 2012 Mac Mini with Lion preinstalled as an XBMC media streamer linked to an AV receiver (and projector) with a Harmony 900 RF-IR remote control and Flirc in one of the Mini's USB ports. I bought Flirc because I had problems with both the standard Harmony Plex setup and later RemoteBuddy in that the first was unable to wake the Mini. Remote Buddy could do it but not as consistently as I would like. Flirc will wake up the Mini, even if I sometimes have to repeat the key press (I tend to use the enter key).
This is what I did.
I set up the Harmony using one of the two recommended remotes (Panasonic TC-P65VT30 or Samsung LN46C650L1F) and made sure all keys were occupied (doesn't mater with what but make a note of it for later use). I also defined a soft key for "Sleep" and assigned a random command to it
I used AppleScript Editor to create two scripts: the first will put the Mini to sleep:
do shell script "pmset sleepnow"
the second starts XBMC:
application "XBMC" activate
In order to link these scripts to shortcut keys I had to use an external app and I chose FastScripts (free with a max of 10 shortcuts) to which I linked these two scripts (Ctrl+Sm Ctrl+X). Using the Flirc.app I associated Ctrl+s and Ctrl+x with the relevant buttons on the Harmony. In the Harmony activity I had also set things up in such a way that every time I switch away from using the Mini the "Sleep" button is activated.
That did it. I can now call up XBMC from the Mini desktop and when I switch away from using the Mini it will be put in sleep mode (fortunately, the Harmony will also use this script when switching everything off in my home theatre).
All this would have been superfluous I think if the flirc.app had had a Mac keyboard with the eject key so I could have used Opt+Cmd+Eject for sleep and I would not have had to mess around with scripts and external apps. On the positive side, I have learned a little bit about using AppleScripts (I am a novice Apple user).
PS. The scripts MUST be moved to ~\Users\username\library\scripts