handleToolbar.sikuli\handleToolbar.sikuli

(Download this script)
import sys

def handleToolbar(toolbar, action):
    x = int(toolbar[0])
    y = int(toolbar[1])
    w = int(toolbar[2])
    h = int(toolbar[3])
    region = Region(x, y, w, h)
    if action == "takeSnapshot":
        region.click()
    elif action == "revertSnapshot":
        region.click()
    elif action == "manageSnapshot":
        region.click()
    # Add code here to handle more controls on toolbar
    else:
        return "action is not supported."

handleToolbar(sys.argv[1:5], sys.argv[5])