Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从C运行applescript_C_Applescript - Fatal编程技术网

从C运行applescript

从C运行applescript,c,applescript,C,Applescript,如何从C命令行实用程序中运行AppleScript? 谷歌搜索不起作用,它只给了我Objective-C解决方案 编辑: 哎呀,我应该在谷歌上搜索“运行shell脚本C”… 现在我找到了system()函数…我将使用exec函数系列,它比system更安全: int exitCode = execlp("osascript", "osascript", "-e", "say \"Hello World\"", NULL); 我已经解决了我自己的问题。。。下次我会寻找更好的解决方案!为什么你不能

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

编辑: 哎呀,我应该在谷歌上搜索“运行shell脚本C”…

现在我找到了
system()
函数…

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

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

我已经解决了我自己的问题。。。下次我会寻找更好的解决方案!为什么你不能在你的项目中使用基金会?CoreFoundation(基于C的API)是一个选项吗?