How to create an AppleScript that will control an Application on a Remote computer ?

You may know that most Softron Applications are AppleScriptable. This enables a lot of too often unknown features. Lot of things can be automated using AppleScripts. For example you can start a playlist automatically at given time of days using iCal, or start recording, etc..

But sometimes you may want to start an AppleScript on one computer (for example using the OnTheAir Video Actions), but start MovieRecorder on a remote computer. For that you have to follow these steps:

On the computer you want to control

  • Check its IP address, the login and password.
  • Enable "Apple Remote Events" in the System Preference / Sharing tab



On the computer that will control the application

  • Make sure that you have the application also installed (so if you want to control MovieRecorder, you need to have MovieRecorder installed)
  • Build your AppleScript as follows (using the correct username, password, and IP address of the target computer)
tell application "MovieRecorder" of machine "eppc://username:passsword@IPaddress"
tell first source
end tell
end tell


About triggering AppleScripts from Softron applications

Add extra lines in the Script

For AppleScripts to work with our applications, you have to make sure that you have added:

  • "on Action (parameter)" at the beginning and "end Action" at the end of the AppleScript
  • "ignoring application responses", and "end ignoring application responses".

So the script should look like this:

on action (parameter)
ignoring application responses
tell application "MovieRecorder" of machine "eppc://username:passsword@IPaddress"
tell first source
end tell
end tell
end ignoring
end action


Authorize the Script

Since macOS 10.14 (Mojave), each script should be authorised by the user to run. But we did not want our users to have to wait that the script is triggered but the application to authorise it (it would be too late). So we have a pane in the preferences of our applications that allows you to run the AppleScript independently. Note that it will really run it.



Warning on macOS 10.15 (Catalina) and later

As you can read on the Catalina release notes, Apple has enhanced the security for triggering remote Apple events, and thus you will need to add extra steps:

To enhance security, AppleEvents and AppleScripts that target an app on a remote system must authenticate as the same user on the remote system. An AppleEvent that targets an app running as a different user receives a procNotFound error.

To allow remote AppleEvents to target apps in any user session, run the following command in Terminal on the server:

defaults write /Library/Preferences/ RestrictAccessToUserSession -bool false

Then disable and reenable Remote Apple Events in System Preferences > Sharing.



Have more questions? Submit a request