This is a small example of GUI scripting in OS X. Pulled from the AppleScript Users list.
OS version: OS X
tell pop up button 2
click
tell menu 1
if the name of every menu item contains "Graphite" then
click menu item "Graphite"
delay 1
end if
end tell
end tell