Zerene Stacker

StackShot "Robot" for Controlling External Programs

As described on the parent page, Zerene Stacker's controller for the StackShot rail allows an external program to be executed whenever a shutter operation occurs. The example there used Apple's /usr/bin/osascript program to launch FlexColor (if necessary) and then send it a simulated keystroke.

Zerene Stacker can also be made to simulate keystrokes and mouse actions by itself, even on Windows systems. This is useful for driving third party applications that are not prepared to be launched or controlled by command line actions.

Simulated events are produced by a specially formatted “External trigger command” that starts with “robot:” and continues with a list of the events to be simulated. For example, the following command simulates moving the mouse to screen coordinate (500,200), pressing and releasing the left mouse button, then pressing and releasing the shift and “n” keys to type a capital “N”:

robot: MM 500 200 MP 16 MR 16 KP 16 KP 78 KR 78 KR 16

As illustrated by this example, the capability is powerful but cryptic. It relies on knowing “magic values” utilized by the Java class named java.awt.Robot. As used in this example, the first two 16's refer to mouse button 1, the second two 16's refer to the shift key, and the 78's refer to the “n” key. Commonly used values include:

Meaning Magic Values
Mouse Button 1 mask 16
Mouse Button 2 mask 8
Mouse Button 3 mask 4
Keyboard Shift 16
Keyboard Ctrl 17
Keyboard Alt 18
Keyboard A-Z 65-90
Keyboard 0-9 48-57

Values for other keys are given in the list of Java constants for the KeyEvent class, HERE.

Supported events are:

Long Form Short Form Parameters
KeyPress KP key number (from KeyEvent class)
KeyRelease KR key number (from KeyEvent class)
MouseMove MM pixel coordinates (X Y)
MousePress MP button mask value (from InputEvent class)
MouseRelease MR button mask value (from InputEvent class)
MouseWheel MW number of increments
Delay DL milliseconds

Caution: Be sure to use press and release events in matched pairs. If you tell the robot to press a key but not to release it, then the computer will continue to act as if the key is held down, even outside Zerene Stacker. The resulting behavior can be quite confusing, particularly if the key that's being “held down” is a modifier like Shift or Ctrl.

stacker/docs/stackshot/robot · Last modified: 2011/09/04 00:42
Copyright 2016, Zerene Systems LLC, all rights reserved.