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