applescript / automator关闭并保存

时间:2011-07-12 08:40:02

标签: applescript

有人能告诉我为什么在automator中的文件集上运行的这个脚本会让我的所有TextMate窗口都打开,同时保存提示等待我的输入,而不是实际保存和关闭文件?

我假设行close window 1 saving yes会保存并关闭文件并继续下一行,但似乎没有。

on run {input, parameters}

    repeat with a from 1 to length of input
        tell application "TextMate"

            activate
            open item a of input

            tell application "System Events"
                tell process "TextMate"
                    tell menu bar 1
                        tell menu bar item "Text"
                            tell menu "Text"
                                tell menu item "Convert"
                                    tell menu "Convert"
                                        click menu item "Tabs to Spaces"
                                    end tell
                                end tell
                            end tell
                        end tell
                    end tell
                end tell
            end tell

            close window 1 saving yes

        end tell
    end repeat

    return input
end run

enter image description here

1 个答案:

答案 0 :(得分:1)

我会说TextMate只是提供保存(或取消)的机会,这是一个错误,或者这是TextMate中命令的不完整实现。但只有TextMate的开发人员可以回答这个问题。

命令及其实现完全取决于开发人员及其应用程序; Apple没有强制或鼓励的标准。 Adobe Creative Suite中的命令close window 1 saving yes会导致文档被保存,然后在没有用户干预的情况下关闭,并且语法是相同的纯粹巧合。