AnsweredAssumed Answered

Formatting Perform AppleScript to connect VPN

Question asked by steveald on Aug 31, 2016
Latest reply on Sep 1, 2016 by nicolai

Our company is switching to VPN for remote users to to connect to our FMS-hosted databases. So I want to automate connecting to VPN with our already established procedure for accessing those databases via a FileMaker script.

I found an AppleScript that makes and continually checks the VPN connection. But I don't know enough about creating AppleScripts or adding them to a FileMaker script to make it work. From what I could find on the subject, I need to modify the AppleScript steps to work in FileMaker; such as adding a \ in front of each double-quote. But, apparently that's not all.

Here is the raw AppleScript code:

 

on idle

tell application "System Events"

tell current location of network preferences

set myVPN to the service "VPN NAME"

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

 

I created a new FileMaker script and added one step - Perform AppleScript. In the step options, I selected Native AppleScript and entered the above code. Saving and then running the script did nothing - no errors, nothing. I tried formatting the AppleScript steps, but nothing worked.

 

Can someone show me what needs to be done with the above AppleScript to make it work in a FileMaker script? Or, if there is a better way to trigger the command to connect to VPN from within a FileMaker script, I'm all ears. And, just to complicate matters, I also need to figure out how to connect to VPN on a Windows 8 machine - which, of course, precludes using AppleScript.

Outcomes