The goal of this example is to demonstrate how to use a joystick axis to trigger a keyboard sequence when it is pushed. This assumes that the reader is familiar with the basics of creating Building Blocks as shown in the Detailed Tutorial.
By default, the OS X built-in screenshot utility is triggered by pressing Command–Shift–3 on a keyboard. This utility creates an image containing the contents of the screen at the moment that it is triggered and saves the image to a file on the desktop.
To use ControllerMate to trigger this function from a joystick axis, three building blocks are needed: an Axis building block that responds to the axis, a Range building block to detect when the axis has been pushed, and a Single Key building block to generate the keystroke.
The Axis building block in this example is configured to respond to the X-Axis of the CH Products CH Pro Throttle USB.
The Range building block is used to detect when the mini-joystick is pushed to the right. It will turn its output ON when its input is between its Lower Limit value and its Upper Limit value.
By watching the output of the Axis building block, it is observed that the X-Axis value is "147" when the mini-joystick is centered and is "233" when the mini-joystick is pushed to the right.
To detect when the X-Axis is halfway between its centered and maximum position, the Lower Limit value of the Range block is set to "198" (i.e. halfway between "147" and "233"). The Lower Limit value can be increased or decreased to adjust how far the mini-joystick needs to be pushed to trigger the screenshot.
The Upper Limit value of the Range block is set to "255" which is somewhat higher than the observed maximum value of the X-Axis. When configured with these values, the output of the Range building block will be OFF when the mini-joystick is centered, and ON when it is pushed to the right.
The Single Key building block is configured to generate the "3" key along with the "Command" and "Shift" modifier keys. When its input turns ON, the building block will generate Command–Shift–3 on ControllerMate's virtual keyboard.
With building blocks configured in this manner, ControllerMate will trigger a screenshot when the mini-joystick on the CH Products CH Pro Throttle USB is pushed to the right.