Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurs when try to connect already connected VPN #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lazy-connect
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down