PDA

View Full Version : [OSX] QProcess failing to execute osascript (AppleScript)



Markus
3rd January 2011, 19:42
Dear all,

I am trying to do shut down from within my application. I am using the following code to do so:


QProcess fQuitter
QString program = "/usr/bin/osascript";
QStringList arguments;
arguments << "-e" << "'tell application \"Finder\" to shut down'";
fQuitter.start(program, arguments);
fQuitter.waitForFinished();


readAllStandardError() returns this:
0:1: syntax error: A unknown token can’t go here. (-2740)

If I copy&paste the same strings into the terminal it works.

Any suggestions?
Markus