[英]can we use Applescript in mac development
当前我在Mac Machine中的命令上使用了一些applescripts.apple是否允许applescripts进行审阅,或者我必须寻找替代方法,但是applescripts对于我的需求很好
Yes. 是。 Apple allows
AppleScript
in the Mac OS app development. Apple允许在Mac OS应用程序开发中使用
AppleScript
。 You just need to add sandboxing
in side your project and list all the app for you are using in AppleScript inside your apps entitlements
file. 您只需要在项目旁边添加
sandboxing
,并在应用程序entitlements
文件内的AppleScript中列出您正在使用的所有应用程序。
If you not added any entitlements
then it will not allowed by apple. 如果您未添加任何
entitlements
那么Apple将不允许。 Try your app in sandboxing mode and you can see AppleScript
not working because of no entitlements
added for app. 在沙盒模式下尝试您的应用程序,您会看到
AppleScript
无法正常运行,因为没有为应用程序添加任何entitlements
。 Note : Some of the app not allowed to access using AppleScript
. 注意:某些应用程序不允许使用
AppleScript
访问。 You app will be rejected by apple review team 您的应用将被Apple审核小组拒绝
To use AppleScript
: 要使用
AppleScript
:
ON
App sandbox in project. ON
App沙箱。 entitlements
required for AppleScript
access. AppleScript
访问所需的所有entitlements
。 (Only If you wish to deploy through Mac App Store) (仅当您希望通过Mac App Store进行部署时)
Few things before starting your work I suggests that you should go through this links in order to be sure that after your hard work you get want to want. 在开始工作之前,我很少建议您通过此链接进行操作,以确保辛苦工作后就想要得到。
Determine Whether Your App Is Suitable for Sandboxing 确定您的应用是否适合沙盒
App Sandbox Temporary Exception Entitlements 应用程序沙箱临时例外权利
Determine Whether Your App Is Suitable for Sandboxing 确定您的应用是否适合沙盒
Sending Apple events to arbitrary apps With App Sandbox, you can receive Apple events and respond to Apple events, but you cannot send Apple events to arbitrary apps.
将Apple事件发送到任意应用程序使用应用程序沙箱,您可以接收Apple事件并响应Apple事件,但不能将Apple事件发送到任意应用程序。
However, for applications that specifically provide scripting access groups, you can send appropriate Apple events to those apps if your app includes a scripting targets entitlement.
但是,对于专门提供脚本访问组的应用程序,如果您的应用程序包含脚本目标授权,则可以向这些应用程序发送适当的Apple事件。
For other applications, by using a temporary exception entitlement, you can enable the sending of Apple events to a list of specific apps that you specify, as described in Entitlement Key Reference.
对于其他应用程序,通过使用临时例外权利,您可以启用将Apple事件发送到您指定的特定应用程序列表的功能,如权利密钥参考中所述。
Finally, your app can use the subclasses of NSUserScriptTask class to run user-provided AppleScript scripts out of a special directory, NSApplicationScriptsDirectory (~/Library/Application Scripts/code-signing-identifier/).
最后,您的应用程序可以使用NSUserScriptTask类的子类从特殊目录NSApplicationScriptsDirectory(〜/ Library / Application Scripts / code-signing-identifier /)中运行用户提供的AppleScript脚本。 Although your app can read files within this directory, it cannot write files into this directory;
尽管您的应用可以读取此目录中的文件,但无法将文件写入此目录; the user must manually place scripts here.
用户必须在此处手动放置脚本。 For details, see the documentation for NSUserScriptTask and WWDC 2012: Secure Automation Techniques in OS X.
有关详细信息,请参阅OS X中NSUserScriptTask和WWDC 2012:安全自动化技术的文档。
A complimentary 免费的
A Strategy for UI Scripting in AppleScript AppleScript中的UI脚本编写策略
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.