Scripting Firefox with Applescript

Someone asked me today how to use Applescript to do something in Firefox. I'm not great with Applescript, but I figured it out. Here's a script that should serve as a model for anytime you want to select a menu item from Firefox (and presumably from other applications as well):

tell application "Firefox"
  activate
  delay 2
  tell application "System Events"
    tell process "Firefox"
      click menu item "Show All History" of menu "History" of menu bar 1
    end tell
  end tell
end tell

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer