If you want to call one of the Exposé functions from an AppleScript, you can do the following (
Note: This script assumes you have the default Exposé key bindings; if you've changed them, this will not work as expected!):
-- All windows
tell application "System Events" to key code 101
-- Application windows
tell application "System Events" to key code 109
-- See desktop
tell application "System Events to key code 103
-- See desktop in slow motion
tell application "System Events" to key code 103 using shift down
For example, you can freak out people with this :-)
tell application "System Events"
set ap to 109
set desk to 103
set win to 101
repeat with a in ¬
{ap, desk, win, win, desk, ap, desk, ap, ap, ¬
ap, desk, win, ap, desk, desk, win, ap, desk, desk}
key code a
end repeat
end tell
[
robg adds: OK, I think that this just might be the funniest AppleScript we've ever published ... and consider it with remote activation via SSH!]