Applescript控制优胜美石打破Excel的?

我有一个控制Microsoft Excel的applescript。 我需要与系统事件通话以点击一些对话框button。 现在,升级(原文如此)到优胜美地后,脚本在两个错误(!!)之间交替:

  1. “系统事件发生错误:连接无效。” 编号-609,光标在“打开wbfile”
  2. “文件”tst“无法打开。 系统事件无法打开“Microsoft Excel 97-2004工作表格式”中的文件。 这个错误是在一个对话框中给出的,然后点击'OK'使脚本成功完成。

不知何故,在“告诉过程”中打开一个工作簿Microsoft Excel“”不起作用。 我可以打开“告诉应用程序”Microsoft Excel中的工作簿“,但是我不能按下对话框button。

任何帮助赞赏!

set wbfile to "/private/tmp/tst.xls" tell application "Microsoft Excel" activate end tell delay 0.1 tell application "System Events" delay 0.1 tell process "Microsoft Excel" delay 0.1 set foo to open wbfile try set cancel to button "Cancel" of window 1 click (cancel) end try try set macros to button "Enable Macros" of window 1 click macros end try try set links to button "Ignore Links" of window 1 click links end try end tell end tell set dat to "flflfl" set output to (dat as string) return output 

您可以使用ignoring application responses并让Excel打开文件而无需等待应用程序的反馈。 脚本将立即转到下一步。 之后,系统事件可以点击button:

 set wbfile to "/private/tmp/tst.xls" ignoring application responses tell application "Microsoft Excel" activate set foo to open wbfile end tell end ignoring delay 1 tell application "System Events" tell process "Microsoft Excel" try set cancel to button "Cancel" of window 1 click (cancel) end try try set macros to button "Enable Macros" of window 1 click macros end try try set links to button "Ignore Links" of window 1 click links end try end tell end tell 

问候,迈克尔/汉堡