How to turn a keyboard key to power on/off button Is it possible to use a script to turn a mac keyboard key to a mac power on or off button?
Bad news is that there is no way of doing this. The power button is a completely different circuit and separate cable from the top case to the MLB. (That is with the model information you have provided). You can use CTRL + Eject to bring up the sleep, shutdown, restart dialog box but there is nothing else for starting the computer up unless you set up a energy saver setting which boots the computer up at a set time.

If the button is damaged in such a way, please recommend your friend either contact AppleCare or an AASP and get his top case replaced. It may seem like a pain but really is the best option.