有些人可以告诉我如何使用Applescript将文本附加到文件的末尾吗?我使用脚本编辑器记录器创建一个宏来帮助我清理一些HTML标记。现在我希望宏转到文件的末尾并写一个句子。 Applescript中有'goto eof'命令吗?
谢谢!
tell application "TextWrangler"
activate
open find window
replace "<b>" using "<strong>" searching in text 1 of document 1 options {search mode:grep, starting at top:true}
replace "</b>" using "</strong>" searching in text 1 of document 1 options {search mode:grep, starting at top:true}
replace "<i>" using "<em>" searching in text 1 of document 1 options {search mode:grep, starting at top:true}
replace "</i>" using "</em>" searching in text 1 of document 1 options {search mode:grep, starting at top:true}
replace "<span>" using "" searching in text 1 of document 1 options {search mode:grep, starting at top:true}
replace "</span>" using "" searching in text 1 of document 1 options {search mode:grep, starting at top:true}
replace " " using "" searching in text 1 of document 1 options {search mode:grep, starting at top:true}
close find window
goto eof
write "hello world!"
end tell
答案 0 :(得分:0)
以下是如何在TextWrangler中执行此操作的方法:
def change
change_column :comments, :attr_1, :string, null: true
change_column :comments, :attr_2, :string, null: true
change_column :comments, :attr_3, :string, null: true
end
语法对于您正在使用的文本应用程序是唯一的。此外,您还可以使用applescript将文本附加到文件,而无需在另一个应用程序中打开文件。 (只需搜索&#34; applescript追加文字&#34;)