Example of GUI scripting

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

I tried to test this but got an error.