У меня есть applescript, который создает html-файлы и использует textedit для их открытия:
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), тогда все будет хорошо. Я ненавижу предоставлять root-доступ к textedit только для редактирования html-файлов, но я думаю, это то, что нужно? Полагаю, я мог бы переключиться на другой текстовый редактор, но у меня остался вопрос, почему TextEdit действует таким образом с файлами html?