Controlling Remote Applications

RubyOSA can control scriptable applications running on other machines. First, the Remote Apple Events option must be checked in the Sharing preferences pane on the remote machine:

After this, you need give RubyOSA the address of the remote machine when getting your application object:

app ='iTunes', :machine => 'my-remote-machine.local')

An authentication window will appear asking you for the username and password of your remote account. If the authentication succeeds, RubyOSA will download the scriptable definition of the remote application. It will then act as normal, except that events will be sent to the remote computer instead of the local one!

If you want to avoid the authentication window you can pass the username and password to RubyOSA directly:

app ='iTunes',
  :machine => 'my-remote-machine.local',
  :username => 'John Foo',
  :password => 'johnfoo42')

Note that you can only control remote applications by providing their names. Trying to provide the signature, bundle ID or even the path on the remote machine won’t work (for now).