从控制台/脚本切换网络链接调节器配置文件 [英] Switch Network Link Conditioner profiles from console/script

查看:119
本文介绍了从控制台/脚本切换网络链接调节器配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以从MacOS命令行或使用脚本切换Network Link Conditioner配置文件,并且通常可以自动执行NLC,如果可以的话如何?

Is it possible to switch Network Link Conditioner profiles from MacOS command line or by using script, and generally is it possible to automate NLC, if so how?

谢谢.

推荐答案

以下小程序在OS X El Capitan中运行良好.您必须传递系统属性:

The following applescript works well in OS X El Capitan.You have to pass a system attribute:

set mode to system attribute "mode"
tell application "System Preferences"
activate
set current pane to pane "com.apple.Network-Link-Conditioner"
end tell

tell application "System Events"
 tell process "System Preferences"
  tell window "Network Link Conditioner"
    click button "ON"
    tell group 1
        click pop up button 1
        click menu item mode of menu 1 of pop up button 1
    end tell
  end tell
 end tell
end tell

通过系统属性(从命令行)传递语法:

Syntax to pass system attribute (from command line):

mode=DSL osascript yourFile.applescript

通过网络链接调节器配置文件(3G,Wifi,Edge)替换DSL

Replace DSL by network link conditioner profiles (3G, Wifi, Edge)

这篇关于从控制台/脚本切换网络链接调节器配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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