-- This script creates a new document instead of showing the "Open" window when the application TextEdit is launched. It should be used in conjunction with a tool like "Do Something When" (http://www.azarhi.com/Projects/DSW/), configured to run when TextEdit launches.
tell application "TextEdit"
set document_count to (count documents)
if (document_count is not equal to 0) then
return
end if
end tell
tell application "System Events"
tell application process "TextEdit"
-- Wait until the "Open" window comes up
set max_poll_cycles to 100000
set cur_cycle to 0
repeat until ((count windows) is not 0) or (cur_cycle is equal to max_poll_cycles)
increment cur_cycle
end repeat
click menu item "Neu" of menu "Ablage" of menu bar item "Ablage" of menu bar 1
end tell
end tell
tell application "TextEdit"
activate
end tell