【问题标题】:How can I bypass grant access dialog when opening Excel,word or powerpoint file using apple scripts使用苹果脚本打开 Excel、word 或 powerpoint 文件时如何绕过授予访问对话框
【发布时间】:2018-09-13 07:05:17
【问题描述】:

操作系统:MacOS High Seirra (10.13.6)

我正在使用下面的代码从苹果脚本中打开一个 Excel 文件

  `set excelFile to "TestExcel_ReadOnly.xlsx"
    set filepath to ¬
        ((folder of file (path to me) of application "Finder" as text) ¬
            & excelFile) as alias
    set sourcePath to POSIX path of filepath

    tell application "Microsoft Excel"
        activate
        open sourcePath
    end tell`

然后我会得到一个对话框,要求授予权限,我想摆脱这个,因为我想远程运行这些苹果脚本

【问题讨论】:

    标签: excel macos applescript


    【解决方案1】:

    这可能会解决问题:

    `超时5秒 尝试 打开文件名 出错
    --Cancel and Grant Access 对话框弹出并停止执行。单击“授予访问权限”按钮以继续执行脚本。

    告诉应用程序“系统事件”告诉进程“Microsoft Excel”告诉应用程序“系统事件”的应用程序进程“Microsoft Excel”的窗口“打开”的按钮“授予访问权限”执行操作“AXPress” 结束尝试 结束超时`

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多