从 C 运行 applescript [英] Run applescript from C

查看:25
本文介绍了从 C 运行 applescript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 C 命令行实用程序中运行 AppleScript?谷歌搜索没有用,它只给了我Objective-C 解决方案...

How can I run an AppleScript from within an C commandline utility? Googling didn't work, it only gave me Objective-C solutions...

糟糕,我应该在谷歌上搜索运行 shell 脚本 C"...
现在我找到了 system() 函数...

Oops, I should have googled for 'run shell script C'...
Now i found the system() function...

推荐答案

我会使用 exec 系列函数,它比 system 更安全:

I would use the exec family of functions, which is safer than system:

int exitCode = execlp("osascript", "osascript", "-e", "say \"Hello World\"", NULL);

这篇关于从 C 运行 applescript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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