要打开空的HTML文件无锁:
首先解决方法:检查 “Display HTML files as HTML code instead of formatted text” 按钮,在文本编辑偏好。 但你必须在文档中编写HTML代码
-
解决方法二:写一个空的HTML文件的有效HTML代码,就像这样:
set base to ""-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
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 "printf " & (quoted form of base) & " > " & quoted form of POSIX path of textFile
tell application "TextEdit"
open file textFile
activate
end tell