Listed on

Open - Apple's little secret

OS X’s open command is the secret sauce for gluing web control panels to OS X applications.
Adding a web control panel to a Mac application can be achieved simply through the use of your favourite web scripting language SSH and the open command. In my case I use phpseclib (http://phpseclib.sourceforge.net) to log in to a mac and then exec the open command with the full path to the application and any arguments.

An example would be:

open -a /Applications/QuickTime\ Player.app http://www.amproductions.com/videos/demos/movies/m2demo2xcdr.mov

Finer control can be had by invoking an osascript and it may also be necessary to close running applications before attempting to start them with new arguments.