我正在尝试将Junos Pulse App集成到我的Mac应用程序中。每当用户第一次在他们的系统中安装应用程序时,它应该自动添加到Junos Pulse列表中,任何可用于以编程方式添加该脚本的脚本。
我还想在每次启动应用时检查VPN连接是否我的应用程序仍在与Junos进行会话。我可以转到Junos Pulse应用程序并输入VPN的凭据,但我无法成功回复我的应用程序。任何人都可以帮助我吗?
答案 0 :(得分:4)
我不完全确定我理解你的问题。但是,可以通过编程方式发现连接的当前状态,以及通过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
*)