From c277060867afbe9c07383d52efa3cd72895f9fbe Mon Sep 17 00:00:00 2001 From: thamaraiselvam Date: Tue, 15 Oct 2019 17:54:26 +0530 Subject: [PATCH] error occured when try to connect already connected VPN --- lazy-connect | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lazy-connect b/lazy-connect index 81b40b0..a589287 100755 --- a/lazy-connect +++ b/lazy-connect @@ -141,7 +141,7 @@ EOF function _lazy_connect_mojave() { vpn_name=$1 - osx_vpn_name="${vpn_name/Connect /}, Not Connected" + osx_vpn_name="${vpn_name/Connect /}" _lazy_connect_get_totp $2 local autofill=$3 @@ -171,8 +171,7 @@ function _lazy_connect_mojave() { tell process "System Preferences" tell window 1 repeat with r in rows of table 1 of scroll area 1 - - if (value of attribute "AXValue" of static text 1 of r as string) is equal to "$osx_vpn_name" then + if (value of attribute "AXValue" of static text 1 of r as string) contains "$osx_vpn_name" then select r end if end repeat @@ -191,7 +190,9 @@ function _lazy_connect_mojave() { delay 1 tell group 1 - click button "Connect" + if button "Connect" exists then + click button "Connect" + end if end tell end tell