The changes don't hurt on 'old' systems.
After switching to Rtf, it appears that a delay is required.
I'm wondering if it's related to the AutoSave feature.
--[SCRIPT]
--=====
on switch_to_text()
tell application "TextEdit"
activate
(*
need_Return = true if the doc is not empty
need_Return = false if the doc is empty *)
set need_Return to (count of characters of document 1) > 0
end tell
tell application "System Events" to tell process "TextEdit" to tell menu bar 1
tell menu bar item 5 to tell menu 1
set maybe to (enabled of last menu item is true)
if maybe then click menu item 4
end tell
(*
If the document is empty, switching from Rtf to Text will not display a dialog
so there is no need to issue a return. *)
if maybe and need_Return then keystroke return
end tell
end switch_to_text
--=====
on switch_to_rtf()
tell application "TextEdit" to activate
tell application "System Events" to tell process "TextEdit" to tell menu bar 1
tell menu bar item 5 to tell menu 1
set maybe to (enabled of last menu item is false)
if maybe then click menu item 4
end tell
end tell
end switch_to_rtf
--=====
my switch_to_rtf()
delay 1 -- REQUIRED under 10.7, maybe linked to AutoSave
my switch_to_text()
--[/SCRIPT]
You will see that the menu item are correctly identified.