For the sake of full disclosure, this was written with bananas, not apples. The doctor may not be kept away.
With AppleScript highlighting:
activate application "TextEdit"
tell application "System Events"
repeat until first window of application "TextEdit" exists
tell application "TextEdit" to make new document at the front
repeat until process "TextEdit" is frontmost
set frontmost of process "TextEdit" to true
set focused of first window of process "TextEdit" to true
repeat with i from 1 to 100
if i mod 15 is 0 then
else if i mod 3 is 0 then
else if i mod 5 is 0 then
I borrowed the logic for appropriately waiting for "TextEdit" to be ready to receive text from this excellent Code Review answer.
I feel like I want to write functions... but I don't know what's available in AppleScript for modularizing code... err script... I'm just getting my toes wet here.