어떻게 Applescript를 통해 VPN 연결을 끊고 다시 시작할 때 VPN에 다시 연결할 수 있습니까? application “System Events”

내 컴퓨터가 부팅 할 때 내 VPN 프로필을 연결하는 AppleScript가 있습니다. 그러나 내 컴퓨터가 잠자기 상태가되면 VPN 연결이 끊어지고 스크립트가 다시 연결하지 않습니다. 또한 서버 연결이 끊어지면 스크립트가 다시 연결하지 않습니다.

여기 내 스크립트가 있습니다 :

tell application "System Events"
    tell current location of network preferences
        set myVPN to the service "MyVPN"
        if myVPN is not null then
            if current configuration of myVPN is not connected then
                connect myVPN
            end if
        end if
    end tell
    return 60
end tell
end idle

Applescript에 익숙하지 않아서 가능한지 알고 싶지만 다른 스크립팅 / 프로그래밍 언어에서는 이벤트를 수신하고 응답 할 수 있습니다.

Applescript는 시스템 이벤트에 응답하는 기능을 가지고 있으며 VPN 프로필 연결이 끊어지면 실행되는 시스템 이벤트가 있습니까?



답변