20 February 2014

Taking a shortcut



Last week, someone asked me if there was a key command to activate the Witness alarm on your Mac. There isn’t, but you can easily create one using AppleScript and Automator:

You will first need to create a service in Automator that switches the alarm on:
  • Launch Automator (in Applications)
  • Choose “Service” from the template menu
  • Select “no input” in the “Service receives” drop-down menu

  •  With Actions selected in the left-hand toolbar, type “run Applescript” in the search field

  • Drag the “Run AppleScript” action to the main view
  • Replace (* Your script goes here *) with the following script:
tell application "WitnessUserAgent" to activate

This will activate the alarm on all your Macs.
(For a script that will deactivate the alarm, you can replace "activate" by “deactivate”.)

  • Choose File > Save
  • Give a name to this service (for example “Activate Witness”)
Now you can assign a keyboard shortcut to this service:
  • Open System Preferences > Keyboard
  • Go to the Shortcuts tab
  • Select “Services” in the left-hand menu
  • Scroll down until you find your service
  • Select the service and click “add shortcut”
  • Press the keys which you would like to use as the shortcut for Witness
  • Make sure the box next to the shortcut is checked


You're all set!


2 comments:

Anonymous said...

It appears like Witness is no longer an offered product or it has been incorporated into Undercover. Can you explain a bit how this script might be useful? What would be a use case and is the "WitnessUserAgent" now part of Undercover?

Winnie Trekker said...

Witness will indeed unfortunately no longer be supported for Yosemite and iOS 8; due to Apple’s focus on security (which is a good thing), it’s becoming near impossible to keep Witness working the way we want it to work…
For now, the application will keep working ‘as it is’, so if you are planning to stay on an older version of Mac OS (and iOS, if you use the Witness Remote app), you can keep using it.
You can use the instructions above if you would prefer to use a keyboard shortcut on your Mac to activate Witness. But you can switch the alarm on just as well from your iOS device, from your account, or from the Witness menu item on your Mac.