Applescript fails with error (-600) when launched

2019-01-14 12:06发布

I've tried searching for this, and have seen others with similar problems but don't seem to have found an answer anywhere....

I have an AppleScript that I am trying to run over ssh so that I can remotely control my mac. This has worked previously with OSX 10.8 but no longer seems to work since upgrading to 10.9.

The command I am executing is:

ssh <user>@mymac.local "osascript -e 'tell application \"iTunes\" to play'"
  • I have already set up RSA keys so the ssh session opens correctly
  • I am connecting as the same user that the Mac is currently logged in and running under
  • iTunes is running on the Mac with that user at the time the script is launched

The script fails, coming back with:

execution error: iTunes got an error: Application isn’t running. (-600)

Similarly, a number of other scripts that I had previously been using also seem to now be broken on 10.9 with the same error, so this seems to be related to the fact that it's running over ssh, rather than an issue with iTunes or a specific application.

I've tried packaging the applescripts as applications, saving them on the remote Mac, and then opening them from within an ssh session, but this also fails:

ssh <user>@mymac.local
open "~/Desktop/Play Music.app"

(Where 'Play Music.app') is an applescript exported as an app).

This does not report an error within the ssh session, but an applescript dialog appears on the remote mac: enter image description here

I also have several scripts that were scheduled with crontab on my Mac, and these are also failing since upgrading.

I assume this is some sort of security change as part of Mavericks, but I can't seem to find a way to make it work again. Does anyone have any solutions to this?

9条回答
该账号已被封号
2楼-- · 2019-01-14 12:39

Application isn’t running(-600) is an operating system error.

An operating system error is an error that occurs when AppleScript or an application requests services from the Mac OS. They are rare, and often there is nothing you can do about them in a script, other than report them.

查看更多
姐就是有狂的资本
3楼-- · 2019-01-14 12:39

for me this happened when I tried to open gitk. Changing back to the branch I was on before, and gitk was able to open again

查看更多
Summer. ? 凉城
4楼-- · 2019-01-14 12:43

Arrrrgh! I don't want this to be the answer, but after trying just about everything, this now seems to be working after a restart.... My guess is that something in appleeventsd got confused (although restarting just appleeventsd on its own didn't fix anything). After a restart osascript seems to be behaving again. I'm still not convinced this is fully fixed, but it does seem to be working for the moment...

查看更多
登录 后发表回答