【发布时间】:2012-05-03 07:08:29
【问题描述】:
我有以下代码
on open the_Droppings
-- set something to {item 1 of the_Droppings, item 2 of the_Droppings}
set file1 to POSIX path of item 1 of the_Droppings
set file2 to POSIX path of item 2 of the_Droppings
set diff to (do shell script "diff " & file1 & " " & file2)
if (diff is equal to "") then
display dialog "files are the same"
else
set diff to ""
tell application "TextEdit"
activate
set NewDoc to make new document
set diff to text of NewDoc
end tell
end if
end open
end
有两个问题! 一:它打开一个很长的对话框。这么久,我什至无法点击确定退出它。 (我知道我可以按回车键) 问题,如何停止对话框? 二:它永远不会将文本放入它打开的新文本编辑器中。
【问题讨论】:
-
它显示的是什么对话框?两个的答案很简单,顺便说一句:
set text of NewDoc to diff- 你有相反的方式:)。 -
diff 的内容显示在对话框中。这是因为 do shell 脚本调用。它的外壳输出正在对话框中显示
标签: macos shell applescript