21 May 2013

Witness and AppleScript: Using Calendar to set a schedule for your alarm

A lot of users are asking about the possibility of setting up a schedule for Witness, auto-arming the alarm at specific times every day. We have not yet implemented such a feature, as we feel this would make the app much more complex, but there is a solution for those in desperate need of a schedule. All you'll need is Calendar, and a script to tell Witness to activate the alarm.

Step 1: the script

You can activate Witness with AppleScript using the following command:

tell application "WitnessUserAgent" to activate

This will activate the alarm on all your Macs (but not on those that have been excluded). To deactivate, you can replace "activate" with "deactivate".

You can download these simple scripts here: https://dl.dropboxusercontent.com/u/19163287/
witness/AppleScript%20samples/DeActivate.zip

Step 2: Calendar

Unfortunately, Apple has removed the ability to run a script from Calendar in Mountain Lion, but there is a workaround: you can save the script as an Application, and then choose “Open File” as the alert option when you create an event in Calendar.

Choose “Other” to select the Application file you want to open.

You'll find the scripts saved as Applications in our download link above as well.

No comments: