我的applescript语法错误有什么问题:期望“然后”等,但找到了类名

时间:2013-05-13 08:01:22

标签: macos automation outlook applescript

tell application "System Events"
set window_check to false
repeat until (window_check)
    set frontApp to name of first application process whose frontmost is true
    if frontApp is "Microsoft Outlook" then
        tell process "Microsoft Outlook"
            if class of front window is draft window then 
            --syntax error: expected "then", etc. but found class name
                display dialog "draft"                  
                set window_check to true
            end if
        end tell
    end if
end repeat
end tell

当我保存脚本时,会弹出错误“语法错误:预期”然后“等等但找到类名”(请参阅​​错误位置的注释)

我的剧本出了什么问题?

2 个答案:

答案 0 :(得分:1)

你必须告诉Outlook,而不是系统事件......

tell application "Microsoft Outlook" to return class of front window is draft window

答案 1 :(得分:0)

如果我没有安装Microsoft Outlook,那么我设法通过删除" window"来编译它。在"草稿"。

之后
 if class of front window is draft then

查看Apple的AppleScript词典,了解它如何识别类:" draft"单独似乎已经是一个类标识符。