これにより、〜/ Desktop / test.rtfが〜/ Desktop / test.htmlとして保存され、HTMLファイルがすでに存在する場合は上書きされます。
tell document 1 of application "TextEdit"
save
path
end tell
do shell script "textutil -convert html " & quoted form of result
UIスクリプトを使用する別のアプローチ(10.8でのみテスト済み):
tell application "System Events" to tell process "TextEdit"
click menu item "Save As…" of menu 1 of menu bar item "File" of menu bar 1
tell sheet 1 of window 1
tell pop up button 1 of group 1 of group 1
click
click menu item "Web Page (.html)" of menu 1
end tell
click button "Save"
end tell
end tell