0

I am trying to integrate Junos Pulse App to my Mac application. Whenever a user installs the application for the first time in their system it should automatically add to the Junos Pulse list, any script available to add this programmatically.

I also want to check for VPN connectivity every time I launch my app whether my app is still in session with Junos. I can go to the Junos Pulse App and enter credentials for the VPN but I am not able to get any successful call back to my app. Can anyone help me out?

1 Answer 1

4

I'm not entirely sure I understand your question. However it is possible to programmatically discover the current status of a connection, and to connect and disconnect via AppleScript. It just isn't documented anywhere. Here's a script that might help you.

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
*)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.