2013-05-13 23 views
0
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 

當我保存腳本,它彈出一個錯誤「語法錯誤:預期‘然後’等但卻發現了類名稱「(請參閱錯誤位置的註釋)有什麼錯我的AppleScript的語法錯誤:預期「然後」等,但發現的類名

我的腳本有什麼問題?

回答

1

你要告訴Outlook中,沒有系統事件......

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

它的工作原理。謝謝 – 2013-05-14 01:28:22

0

但是,我沒有安裝Microsoft Outlook,此刻,我設法通過在「草稿」之後刪除「窗口」來編譯此文件。

if class of front window is draft then 

查看Outlook的AppleScript詞典以查看它是如何識別類的:「草稿」本身似乎已經是類標識符。

+0

嗨MrAsterisco。我將「草稿窗口」替換爲「草稿」。但是得到結果: 錯誤「變量草稿未定義。」號碼-2753從「草案」 – 2013-05-13 08:59:02

+0

您好MrAsterisco。我將「草稿窗口」替換爲「草稿」。 但是得到結果: 錯誤「變量草稿未定義。」編號-2753從「草案」。 我看過Outlook的AppleScript字典,只能找到類 - 「草稿窗口n [inh。window> item]:消息草稿窗口。 對 保存響應。 – 2013-05-13 09:05:45

+0

我認爲adayzdone是正確的。您應該向系統事件提出這些類型的問題,而不是直接嚮應用程序提問。 – MrAsterisco 2013-05-13 17:26:34

相關問題