Remote AppleEvents example

Here’s a quick snip to illustrate the basics of Remote AppleEvents.

LocalApp refers to the application on the machine where the script will be run from. AppleScript uses this application’s dictionary as its reference for the remote application. sameRemoteApp is the application you want to control on the remote machine. For obvious reasons the 2 applications (LocalApp, sameRemoteApp) need to be the same application (i.e. iTunes), and probably should be the same version.

“eppc://username:password@remoteMachine” is the protocol for remote AppleEvents. Replace remoteMachine with any of the following: ip address (if manualy assigned), the machine’s Rendezvous address (machine.local), or the Fully Qualified Domain Name (machine.yourdomain.com).

Thanks to Tim Rutter and Steve Mills for clarifying a few things.

OS version: OS X

using terms from application "LocalApp"
tell application "sameRemoteApp" of machine "eppc://username:password@remoteMachine"
statements
end tell
end using terms from