This is a python script wrapped in an Applescript.
See the 3 mouseclick(x, y); commands near the end that clicks 3 positions on the menu bar.
do shell script "
python <<-END
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
mouseEvent(kCGEventLeftMouseUp, posx,posy);
time.sleep(2);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
mouseclick(5, 10);
time.sleep(2);
mouseclick(200, 10);
time.sleep(2);
mouseclick(300, 10);
time.sleep(2);
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
END
"