【发布时间】:2014-06-25 15:47:53
【问题描述】:
我正在尝试将 Junos Pulse 应用程序集成到我的 Mac 应用程序中。每当用户首次在其系统中安装该应用程序时,它都应自动添加到 Junos Pulse 列表中,任何可用于以编程方式添加的脚本。
我还想在每次启动我的应用程序时检查 VPN 连接是否我的应用程序仍在与 Junos 会话。我可以转到 Junos Pulse 应用程序并输入 VPN 凭据,但我无法成功回叫我的应用程序。谁能帮帮我?
【问题讨论】:
我正在尝试将 Junos Pulse 应用程序集成到我的 Mac 应用程序中。每当用户首次在其系统中安装该应用程序时,它都应自动添加到 Junos Pulse 列表中,任何可用于以编程方式添加的脚本。
我还想在每次启动我的应用程序时检查 VPN 连接是否我的应用程序仍在与 Junos 会话。我可以转到 Junos Pulse 应用程序并输入 VPN 凭据,但我无法成功回叫我的应用程序。谁能帮帮我?
【问题讨论】:
我不完全确定我理解你的问题。但是,可以以编程方式发现连接的当前状态,并通过 AppleScript 进行连接和断开连接。它只是没有记录在任何地方。这是一个可能对您有所帮助的脚本。
property DisplayName : "CONNECTIONNAMEHERE"
tell application "Junos Pulse"
activate
delay 1
repeat with c in connections
if connectionDisplayName of c is DisplayName then
tell me to connect to c
-- tell me to disconnect from c
exit repeat
end if
end repeat
end tell
on connect to c
tell me to push_button for c to "connect"
end connect
on disconnect from c
tell me to push_button for c to "disconnect"
end disconnect
on push_button for c to which
if which is "connect" then
set notdone to "Disconnected"
set isdone to "Connected"
else
set notdone to "Connected"
set isdone to "Disconnected"
end if
tell application "Junos Pulse"
set istr to indexStr of c
if connectionStatus of c is notdone then
-- Time to connect
do PulseMainUI command "SELECTCONNECTION" ConnectionIndexStr istr
do PulseMainUI command "CLICKCONNECTBUTTON" ConnectionIndexStr istr
do PulseMainUI command "QUITPULSEUI" -- ConnectionIndexStr istr
else if connectionStatus of c is isdone then
-- display dialog "Connection is already " & connectionStatus of c
do PulseMainUI command "QUITPULSEUI" -- ConnectionIndexStr istr
else
display dialog "Connection status is " & connectionStatus of c
end if
end tell
end push_button
(*
QUITPULSEUI
FORGETALLSAVEDSETTINGS
ADDCONNECTIONCLICKED
DELETESELECTEDCONNECTION
EDITSELECTEDCONNECTION
CLICKCONNECTBUTTON
SELECTCONNECTION
ConnectionIndexStr
*)
【讨论】: