HTML ファイルを作成し、textedit を使用してそれらを開く AppleScript があります。
try
tell application "Finder" to set save_folder to (target of window 1) as alias
on error
set save_folder to path to desktop
end try
set textFile to (choose file name with prompt "Enter file name:" default location save_folder default name "Comment.html") as text
if textFile does not end with ".html" then set textFile to textFile & ".html"
do shell script "touch " & quoted form of POSIX path of textFile
tell application "Finder"
set file type of (textFile as alias) to "html"
set creator type of (textFile as alias) to "sfri"
end tell
tell application "TextEdit"
open file textFile
activate
end tell
ファイルがロックされた状態で開くのは面倒です。しかし、ファイルタイプと作成者を TEXT と ttxt (TextEdit の識別子) に設定すると、すべて問題ありません。HTMLファイルを編集するためだけにtexteditへのルートアクセスを許可しなければならないのは嫌ですが、それが必要だと思いますか? 別のテキスト エディターに切り替えることもできると思いますが、なぜ TextEdit が html ファイルでこのように動作するのかという疑問が残ります。