Load webpage, print, load, print, etc. with Applescipt

First, Mac are super cool because beneath that suave exterior is unix. A computer that is easy to use AND super powerful.

But not everything needs unix. Here is the coolest applescript to

  1. load a random bingo card generator which I built in php (the unix part)
  2. print the page
  3. go to step 1 fifty times

[applescript]
set i to 1
repeat 20 times
tell application "Safari"
activate
tell application "System Events"
tell process "Safari"
keystroke "r" using command down
delay 1

keystroke return
end tell
end tell
–open location "http://www.apple.com"
end tell
delay 3
tell application "System Events"
tell process "Safari"
keystroke "p" using command down
delay 0.5
keystroke return
end tell
end tell
delay 4
say i
set i to i + 1
end repeat

[/applescript]