你可以从一个应用程序雨燕执行AppleScript脚本 [英] Can you execute an Applescript script from a Swift Application

查看:150
本文介绍了你可以从一个应用程序雨燕执行AppleScript脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的AppleScript发送电子邮件。我怎样才能把它从斯威夫特应用程序中?

I have a simple AppleScript that sends an email. How can I call it from within a Swift application?

(我是不是能够找到通过谷歌的答案。)

(I wasn't able to find the answer via Google.)

推荐答案

未经检验的,但它看起来像人可以做这样的事情(加入任意脚本路径):

Untested, but it looks like one can do something like (arbitrary script path added):

import Foundation

let task = NSTask()
task.launchPath = "/usr/bin/osascript"
task.arguments = ["~/Desktop/testscript.scpt"]

task.launch()

这篇关于你可以从一个应用程序雨燕执行AppleScript脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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