Macro help: When on VPN XXX change network location

Maybe some one can help me on this issue.

When I'm at home I often need to connect via VPN to my University. However, to web browse while on that particular VPN I cannot use my customised network location (called Home location).

I can, of course, change it by going to the Network in System Preferences and select Automatic location there. But perhaps there is a macro that can do that automatically.

Basically what I'd like that macro to do is:

– if my VPN University is on, change my network location to Automatic.

to invoke the change, can you use a "wireless network" trigger? That fires up a macro when connecting to a wi-fi network matching a particular name. It can match on just part of the name if your University network name has part that changes.
As for the action to change location setting, there's a macro action for "Open a System Preference Pane", and you can specify the "Network" panel.

After that point, I think you're into AppleScript UI scripting. I can help take a look at that if you get to there.
Avi

Thanks for the reply.

Alas the "wireless network" trigger cannot be used in this particular case. The change is on applying a VPN not on changing the network. :frowning:

in that case, in your position, if it was a priority, I'd try to wrap a macro or script around the action of connecting to the VPN. IE, the "Connect to Uni" macro does 2 things - makes the network connection, and changes the location setting.

If there is a good programmatic way to select your VPN then it's not too hard - you're just expanding the scope of the macro out by one level. If not, then you're into scripting UI elements (script basically emulates your clicks while connecting to VPN). But then, you'd probably need UI scripting anyway to select location from the network control panel.

You'd need to bookend that with a "disconnect" macro which does the opposite.

Literally... :exploding_head:

:relieved: