Here is an example of AppleScript:
tell application "Foo" beep end tell tab