Feature Request : scripting before connection

Suggestions/comments/criticisms are welcome here

blop

Posts: 1
Joined: Wed Aug 04, 2010 5:53 pm

Post by blop » Wed Aug 04, 2010 7:48 pm
Hello,

First of all, thank you for your nice software! It's working great :mrgreen:

I saw you recently added the possibility to execute an applescript after the connection/disconnection.

I'd like to know if you could also add an option to execute a script BEFORE the connection to the vpn server is started.
I need to execute a script, and be sure it's completed, before the connection to the server can be made (so it must wait for the script, maybe check the result code also).

That shouldn't be too much work :oops:

Maybe you should have :
before connection script
after connection script -> that one already exists
before disconnection script
after disconnection script -> that one already exists

So that all possible cases are covered ;)

Thank you already !

Olivier

James

User avatar
Posts: 2053
Joined: Thu Sep 04, 2008 9:27 pm

Post by James » Thu Aug 12, 2010 11:39 am
Hi Olivier,

Thanks for the feedback. We are definitely looking at adding the ability to run actions on more events, so it's something you should see if a future version.

In the meantime a workaround could be to write an AppleScript script that first runs your own code, and then tells Viscosity to connect your VPN connection.

Cheers,
James
James Bekkema
Viscosity Developer

Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs

hyper

Posts: 3
Joined: Mon Feb 14, 2011 11:49 pm

Post by hyper » Mon Feb 14, 2011 11:50 pm
Hi James,

Any update on this? Do you have a target release date in mind?

James

User avatar
Posts: 2053
Joined: Thu Sep 04, 2008 9:27 pm

Post by James » Tue Feb 22, 2011 3:55 am
Hi hyper,

Support has been added to the latest beta, however there is no GUI for it at this stage. The latest beta version can be downloaded here. If you're happy to edit the config file directly it's quite easy to add a "Before Connect" script:

1. Find the config file Viscosity has generated for your connection. This can be found at:
Your Home Folder/Library/Application Support/Viscosity/OpenVPN/#/config.conf

2. Open the config file in a text editor (such as TextEdit) and add the following line (replacing the path to your script):
#viscosity preconnectscript /path/to/script.scpt

3. Save the changes and restart Viscosity.

Viscosity also now support global Connected/Disconnect scripts. Again, there is no GUI for this yet however you can set global Connected/Disconnected scripts from the Terminal (you'll have to restart Viscosity afterwards), for example:

defaults write com.viscosityvpn.Viscosity globalConnectedScript "/path/TestConnect.scpt"
defaults write com.viscosityvpn.Viscosity globalDisconnectedScript "/path/TestDisconnect.scpt"

If you run into any problems with the latest beta version please let us know!

Cheers,
James
James Bekkema
Viscosity Developer

Web: http://www.sparklabs.com
Support: http://www.sparklabs.com/support
Twitter: http://twitter.com/sparklabs
4 posts Page 1 of 1