问题
How can I run an AppleScript from within an C commandline utility? Googling didn't work, it only gave me Objective-C solutions...
EDIT:
Oops, I should have googled for 'run shell script C'...
Now i found the system()
function...
回答1:
I would use the exec
family of functions, which is safer than system
:
int exitCode = execlp("osascript", "osascript", "-e", "say \"Hello World\"", NULL);
来源:https://stackoverflow.com/questions/9957672/run-applescript-from-c