I’m trying to create macros to enable VPN then I’m on a public network and disable it then I’m at home. For VPN I’m using Viscosity and it’s Apple Script support.
Right now my macro looks like this:
Triggered by any of the following:
Any Wireless Network is Connected
Will execute the following actions:
If All Conditions Met
A wireless network with name matching ‘iadramelk.*’ is connected
Execute the Following Actions:
Execute AppleScript
tell application "Viscosity" to disconnectall
Otherwise, Execute the Following Actions:
Execute AppleScript
tell application "Viscosity" to connect "Germany"
Then I click Try it works as expected. But then I’m actually connection to network nothing happens. Do I miss something? What do I need to change to make it work?
I do not know for sure, but if I had to guess, I think the problem might be that when your computer wakes from sleep, Keyboard Maestro runs this macro very quickly, and the Wi-Fi network might not have been joined yet.
What if you added a “Pause 10 seconds” statement at the top of the macro, and see if that helps?
Any time you have “nothing happens”, you need to figure out where the problem lies.
Follow the instructions on the Wiki troubleshooting entry Macros Not Firing.
After that, you will have a better idea of what exactly the problem is and then you can ask a more specific question.
There is an issue with the wireless network trigger in 7.0 that will be fixed in 7.0.1, although that will generally result in the macro firing multiple times quickly, but if enough of them fire then they will all be canceled so that may be your issue.