|
cAppleScriptSupport
AppleScript Support
AppleScript Support This document is about AppleScript Support -- making Tunnelblick do things via scripting. Tunnelblick itself also uses scripts; see Using Scripts. Tunnelblick 3.2beta04 and above may be controlled using AppleScript. AppleScripts may connect, disconnect, or list configurations. An example of using Tunnelblick's AppleScript support to solve a particular problem is at https://groups.google.com/d/topic/tunnelblick-discuss/1MDrN6__mdA/discussion. 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. AppleScript Dictionaryapplication n : contains configurations. configuration n : A VPN configuration. contained by application. properties 'EXITING' means disconnecting or disconnected. 'LAUNCH' means the configuration will be connected automatically when Tunnelblick launches. The number of bytes that have come in through the connection since Tunnelblick was launched. (For client configurations only. This will return "0" for configurations that are functioning as a server.)Available in Tunnelblick 3.3beta02 and later. The number of bytes that have gone out through the connection since Tunnelblick was launched. (For client configurations only. This will return "0" for configurations that are functioning as a server.) Available in Tunnelblick 3.3beta02 and later. connect v : Connect a VPN configuration. → boolean : Returns true if a connection is being attempted, false if the configuration is already connected. disconnect v : Disconnect a VPN configuration. → boolean : Returns true if a disconnection is being attempted, false if the configuration is already disconnected. connect all v : Connect all unconnected VPN configurations. → integer : Returns the number of configurations for which a connection is being attempted. disconnect all v : Disconnect all connected VPN configurations. → integer : Returns the number of configurations for which a disconnection is being attempted. disconnect all except when computer starts v : Disconnect all connected VPN configurations except 'when computer starts' configurations. → integer : Returns the number of configurations for which a disconnection is being attempted. Examplestell application "Tunnelblick" get configurations--> {configuration "Work", configuration "Work-Development", configuration "Home", configuration "Test"} disconnect all--> 0 connect "Work-Development"--> true disconnect (get name of second configuration)get name of configuration 2--> "Work-Development"disconnect "Work-Development"--> true connect (get name of first configuration where state = "EXITING")get name of configuration 1 whose state = "EXITING"--> "Work"connect "Work"--> true disconnect all except when computer starts--> 1 get state of second configuration--> "EXITING" get state of first configuration where name = "Work"--> "EXITING" get name of configurations--> {"Work", "Work-Development", "Home", "Test"} get state of configurations--> {"EXITING", "EXITING", "EXITING", "EXITING"} get autoconnect of configurations--> {"NO", "NO", "NO", "NO"} end tell PLEASE USE THE TUNNELBLICK DISCUSSION GROUP FOR COMMENTS OR QUESTIONS | |