On Apr 4, 2014, at 00:17 , Iurista GmbH wrote:
Hi all
I would like to open a program with root privileges. So my Script looks like:
set password to "pwpwpwpw" <--THIS ONE I GET FROM THE KEYCHAIN do shell script quoted form of ".../content/MacOS/XXX" user name "root" password pw with administrator privileges
It works quite fine, but: the applescript does not continue after this step, but is obiously waiting for something coming back. I tried to send output to dev/null or > /dev/null 2>&1 &, but nothing has helped. Even by googling I did not found a solution...
Does anybody know, how the script can be stopped or continued, without first quitting the app XXX
Thanks for a hint Rudolf
Hello,
You will need to wrap the 'do shell script' in an 'ignoring application responses' block. However that isn't enough, because the 'do shell script' is an internal command; therefore you need to get some (any) other application to do it for you (that way an actual apple event gets sent out). Here's an example to test with: ignoring application responses tell application "System Events" -- <- any convenient app do shell script "sleep 10; say 'I am still here!'" -- <- any script content end tell end ignoring
I'm in pre-sandbox times so I don't know if you can still do that, but if you can, then that is the easiest answer.
Alternatively, if you have access to the Cocoa API (e.g. via AppleScriptObjC) then you could probably use NSTask instead of 'do shell script', as NSTask is asynchronous by default.
Manoah F. Adams federaladamsfamily.com/developer
|