Vous pourriez placer quelque chose comme cet Applescript dans votre site web Menu Applescript et l'utiliser pour lister vos réseaux préférés, en choisir un et s'y connecter.
set the getList to paragraphs of (do shell script "networksetup -listpreferredwirelessnetworks en0")
set title to item 1 of getList
set wifi_list to items 2 thru -1 of getList
set the chosen_newtwork to choose from list the wifi_list with prompt "Choose a " & title without multiple selections allowed
if the chosen_newtwork is false then return
do shell script "networksetup -setairportnetwork en0 " & (chosen_newtwork as string)
![enter image description here]()
(Je ne peux pas dire que c'est parfait car j'ai constaté qu'il ne veut pas toujours se connecter mais je ne sais pas si c'est juste mon routeur/wifi).
Mise à jour.
En utilisant la même idée ci-dessus, vous pourriez également créer une liste de bannissement des mauvais ssids.
Et les filtrer.
La commande principale utilise un aéroport au lieu de la commande networksevice, ce qui est un peu plus lent. Mais les recherches de disponible sur des réseaux au lieu d'une simple préférence.
set bannedList to {"BTWifi-X"}
set wifi_list to {}
set the getList to paragraphs of (do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s |awk '{print $1}'")
set title to item 1 of getList
repeat with i from 2 to number of items in getList
set this_item to item i of getList
if this_item is not in bannedList then
if this_item is not in wifi_list then -- stops duplicates from original list
copy this_item to end of wifi_list
end if
end if
end repeat
set the chosen_newtwork to choose from list the wifi_list with prompt "Choose a " & title without multiple selections allowed
if the chosen_newtwork is false then return
do shell script "networksetup -setairportnetwork en0 " & (chosen_newtwork as string)