At night I like to listen to my favorite radio programs from back home. Since I am living abroad my alarm clock radio doesn't do the job. Fortunately, I can receive my favorite channels through the internet. But there is one big disadvantage: I need to leave my bed to turn off the music, and computer. I do not like that. Therefore, I decided to spend some time get control over my Mac via my wifi enabled Palm Tungsten C.
Due to my solid understanding of PHP, xHTML and CSS I decided to take the approach of a web interface. Assuming that from a web Interface I would controle my Mac with command line, and command line executed AppleScript. This indeed works.
The first thing that needs to be done, after your Apache and PHP are installed, is to change the user of your web-server. Normally this is www, but this needs to be the short name of your user account. The web interface will also only be able to controle your account. This user account you can change in the following file, with vi for example:
A bit down in the document you will find:
Changing 'User www' to 'User shortname. You can find your account's shortname in the System Preferences tab Accounts.
After Apache is restarted, we are ready for the real work. We will work with two files. The first one is our interface and the second performance the task. We start with the second one.
At http://jochem.doncqueurs.com/mac/remote/ you will find both files. The first one is called remote.php, and the second one remote-execute.php. In the second you will find the command, the first one will link to this command. To add new commands you need to have an understanding of AppleScript and a tiny little bit PHP. If you have this understanding you can add more commands for more applications yourself without too much problems.
The first file just links to the file that executes the commands. Once the command is executed the program returns automatically to the first file.
John Masone put at his website http://www.whatsmyip.org/itunesremote/ some ideas of more scripts for controlling itunes.
Good night! ;-)
Jochem Donkers (email@example.com)
Hack #56 in Mac OS X Panther Hacks