function get_wifi_ssid()
local function get_key_for_value(t, value)
for k,v in pairs(t) do
if v==value then return k end
end
end
local CurrentSethash = plist.read("/Library/Preferences/SystemConfiguration/preferences.plist").CurrentSet:gsub("%/Sets%/","")
local wifiplist = plist.read("/Library/Preferences/SystemConfiguration/com.apple.wifi.plist")
local results = get_key_for_value(wifiplist["Custom network settings"], CurrentSethash)
return results
end
sys.alert(get_wifi_ssid())
|