This posting is older than 6 months and can contain outdated information.
Hi,
I found a solution for this at http://oguzarduc.blogspot.de/2012/08/applescript-for-activating-airplay.html
This script activates AirPlay mirroring on OS X Mountain Lion 10.8:
------------------------------------------------------------------------
tell application "System Preferences"
set current pane to pane "com.apple.preference.displays"
activate
end tell
tell application "System Events"
tell process "System Preferences"
click pop up button 1 of window 1
click menu item 2 of menu 1 of pop up button 1 of window 1
end tell
end tell
tell application "System Preferences"
quit
end tell
------------------------------------------------------------------------
Now I can hit the button on my BT remote while sitting in the living room and having my mac mirrored to the TV.