Page 1 of 1

Feature Request : scripting before connection

Posted: Wed Aug 04, 2010 7:48 pm
by blop
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

Re: Feature Request : scripting before connection

Posted: Thu Aug 12, 2010 11:39 am
by James
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

Re: Feature Request : scripting before connection

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

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

Re: Feature Request : scripting before connection

Posted: Tue Feb 22, 2011 3:55 am
by James
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