macOS Sierra-如何启用“允许远程自动化"使用命令行 [英] macOS Sierra - how to enable "Allow Remote Automation" using command line

查看:185
本文介绍了macOS Sierra-如何启用“允许远程自动化"使用命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究macOS Sierra(10.12.2)中的自动化内容.通过使用python的atomac支持,我可以启动safari浏览器,并通过Safari->首选项->高级->选中启用开发菜单"启用设置,然后选择开发->允许远程自动化".从自动化角度看,这似乎不太一致.我想知道是否有任何Shell命令可以实现这一点.

I am working on an automation stuff in macOS Sierra (10.12.2). By using python's atomac support I can launch the safari browser and make the settings enabled via Safari -> Preferences -> Advanced -> check "enable Develop Menu" and then select "Develop -> Allow Remote Automation". Looks like this is not so consistent for automation perspective. I would like to know if there is any shell command to make this possible.

推荐答案

好的,根据我的评论:

您可以执行defaults write com.apple.Safari IncludeDevelopMenu YES通过终端激活开发菜单.您可以使用子流程模块为python执行此命令.

You could do defaults write com.apple.Safari IncludeDevelopMenu YES to activate the development menu via terminal. You could get python to execute this command for you using the subprocess module.

根据这个这个问题,看来以前曾经能够简单地做到defaults write com.apple.Safari AllowRemoteAutomation 1.但是,自Safari 10起,此选项显然受到了更高安全性协议的保护(可能是由于引入了系统完整性保护).我一直在寻找现在可以保存设置的plistfile,但是我找不到它.也许它甚至不再存在于实际的plistfile中.

According to this this question it seems that one used to be able to simply do defaults write com.apple.Safari AllowRemoteAutomation 1. However, since Safari 10 this option has apparently been subjected to a higher security protocol or something (maybe because of the System Integrity Protection that was introduced). I've been looking for the plistfile that now holds the setting, but I have not been able to find it. Maybe it's not even there in an actual plistfile anymore.

我想这给您留下了两个选择:

I guess this leaves you with 2 options:

  1. 使用苹果的osascript模拟所需的鼠标单击.
  2. AskDifferent
  1. Use apple's osascript to simulate the needed mouseclicks.
  2. Repost your question on AskDifferent or Apple's own developers forum, since you are more likely to find someone with in-depth knowledge of macOS.

这篇关于macOS Sierra-如何启用“允许远程自动化"使用命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆