首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Tunnelblick选择随机VPN的Applescript

使用Tunnelblick选择随机VPN的Applescript
EN

Stack Overflow用户
提问于 2013-01-06 19:52:37
回答 1查看 298关注 0票数 1

我一直试图编写一个简单的applescript来获取可用VPN连接的列表,并选择一个随机的连接,如下所示:

代码语言:javascript
复制
tell application "Tunnelblick"
    set the_values_list to get configurations
    set the list_count to the count of the_values_list --gets number of items in list
    set pick to random number from 1 to list_count --has it choose a random item
    set generated_choice to item pick of the_values_list --sets the generated item as the choice
    return generated_choice --displays the choice
end tell

这将返回:

应用"Tunnelblick“的配置"USA.Indiana.SouthBend_LOC1S2.UDP”

但是,如果我试图通过替换返回来连接:

代码语言:javascript
复制
connect generated_choice --displays the choice

我收到一个错误:

Tunnelblick得到了一个错误:无效的键形式。

为什么会发生这种事?似乎它传递的是数组(列表),而不是值。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-01-11 03:39:26

后续工作

connect (get name of (configuration pick))

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14186068

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档