Connect to a specific Wifi

I would like to create a macro that connects to a specific wifi network when run.
I've been trying with shell scripts and Apple Script but I don't seem to be able to find the right command.

Anyone knows how this is done?

Thanks!