Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am running the following script (called Restart AppleTV) using automator :

on run {input, parameters}

  do shell script "sudo killall coreaudiod" with administrator privileges

  return input
end run

However, I get the following in the statusbar :

enter image description here

The terminal code DOES run, but the gear never disappears unless I manually click the x button .. How can I get rid of this automatically or prevent it from appearing in the first place ?

--Note : This only happens when I run it by double clicking the exported .app file, but not when I run the code through automator.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Try:

on run {input, parameters}
    set myPassword to "My Password"

    ignoring application responses
        do shell script "sudo killall coreaudiod" password myPassword with administrator privileges
    end ignoring
end run

OR

on run {input, parameters}
    set myPassword to "My Password"

    ignoring application responses
        do shell script "sudo killall coreaudiod &>/dev/null &" password myPassword with administrator privileges
    end ignoring
end run
share|improve this answer
    
The edit fixed it. Can you please explain what you have done ? For personal learning purposes. I see that you added &>/dev/null &, what does that do ? –  Render Oct 13 '13 at 15:51
    
&>/dev/null & redirects both stdout and stderr so the command is not waiting for a response. –  adayzdone Oct 13 '13 at 16:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.