如何从在Mac(OS X)沙盒应用程序运行AppleScript [英] How to run an AppleScript from a sandboxed application on a Mac (OS X)

查看:679
本文介绍了如何从在Mac(OS X)沙盒应用程序运行AppleScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发用于MacOSX上10.9使用Qt 5.2.0.Framework在Mac App Store的应用程序。

We are developing an application for the Mac App Store using Qt 5.2.0.Framework on MacOSX 10.9.

下面是创建Microsoft Excel工作簿并保存到任何位置的简单的AppleScript。

Here is a simple AppleScript that creates a Microsoft Excel workbook and saves to any location.

tell application "Microsoft Excel"
    set myworkbook to make new workbook
    set fname to POSIX file "/Private/var/root/Download/ExcelFile" as text
    save workbook as myworkbook filename fname
end tell

以上脚本保存为 Untitled.scpt /库/ ApplicationScript /

在应用程序中,我们使用Cocoa框架来执行的AppleScript。

Inside the application, we use the Cocoa framework to execute the AppleScript.

这AppleScript的工作在非沙盒应用程序。它没有在沙盒应用程序。

This AppleScript works in a non-sandboxed application. It fails in a sandboxed application.

我的问题是:你如何在沙盒应用程序中使用的AppleScript?还是有来替代?

My question is: How do you use an AppleScript in a sandboxed application? Or is there an alternative to this?

请告诉我的解决方案,因为我的项目是由该延迟。

Kindly tell me the solution, because my project is being delayed by this.

感谢

推荐答案

有您的code两个问题:

There two issues with your code:


  • Excel中可能还不支持 com.apple.security.scripting的目标,所以你需要 com.apple。 security.temporary-exception.apple事件(见<一href=\"http://stackoverflow.com/questions/21636464/how-can-i-know-the-apple-event-access-groups-used-by-an-application/21679279#21679279\">here如何找出它是否支持它,这里的如何通过添加你想要的目标束标识符数组的临时例外工作。你必须在这个问题的旧屏幕截图。)

  • Excel probably doesn't yet support com.apple.security.scripting-targets, so you would need com.apple.security.temporary-exception.apple-events (see here how to find out if it supports it and here how to work with the temporary exception by adding an array of bundle-identifiers you want to target. You had that in the old screenshot of this question.)

的脚本的目标以及为 com.apple.security.temporary-exception.apple事件的权利是束标识符数组。你会看到它在X $ C $Ç这样的:

The entitlement of scripting-targets as well as for com.apple.security.temporary-exception.apple-events is an array of bundle-identifiers. You would see it in Xcode like this:

一个Mac App Store的应用程式,例如不能安装在共享位置什么/库/ ApplicationScript (见的应用程序商店审查指南部分2.15)。您需要将脚本存储您的容器内,并从那里运行它。

A Mac App Store app must not install anything in shared locations like /Library/ApplicationScript (see App Store Review Guidelines Section 2.15). You need to store the Script inside your Container and run it from there.

这篇关于如何从在Mac(OS X)沙盒应用程序运行AppleScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆