Highlighted Articles |
AppleScript SupportOn This Page Controlling Tunnelblick with AppleScriptThis document is about making Tunnelblick do things via scripting. Tunnelblick itself also uses scripts; see Using Scripts. AppleScripts may connect, disconnect, or list Tunnelblick configurations. Please note that the verbs only initiate actions. The "connect" verb, for example, is the equivalent of clicking the "Connect" button. It returns immediately after starting an attempt to connect using a particular configuration and does not indicate the connection has been accomplished successfully. For an example of using Tunnelblick's AppleScript support to solve a particular problem, see this discussion. Controlling Tunnelblick from the Command LineYou can invoke AppleScript from the command line to control Tunnelblick. You can connect, disconnect, and list configurations. One way is to store the AppleScript in a file and then invoke it with osascript name-of-file Another way is to include the AppleScript commands in the command line with, for example, osascript -e "tell application \"/Applications/Tunnelblick.app\"" -e "connect \"configuration-name\"" -e "end tell" replacing configuration-name with the name of your configuration. AppleScript Dictionaryapplication n : contains configurations. configuration n : A VPN configuration. contained by application. properties name (text, r/o) : Name of the configuration. state (text, r/o) : State of the configuration. autoconnect (text, r/o): bytesIn (text, r/o) : bytesOut (text, r/o) : connect v : Connect a VPN configuration. connect text : Name of configuration to connect. disconnect v : Disconnect a VPN configuration. connect all v : Connect all unconnected VPN configurations. disconnect all v : Disconnect all connected VPN configurations. disconnect all except when computer starts v : Disconnect all connected VPN configurations except 'when computer starts' configurations. added or removed configurations v : Tells Tunnelblick that configurations have been added or removed, so it can update the menu and the list of configurations in the "VPN Details" window. changed openvpn configuration file for v : Tells Tunnelblick that an OpenVPN configuration file has been modified, so it can update settings in the "VPN Details" window. changed openvpn configuration file for text : Name of configuration for which the OpenVPN configuration file has been modified. Examplestell application "Tunnelblick" get configurations disconnect all connect "Work-Development" disconnect (get name of second configuration) connect (get name of first configuration where state = "EXITING") disconnect all except when computer starts get state of second configuration get state of first configuration where name = "Work" get name of configurations get state of configurations get autoconnect of configurations end tell |