Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
Lazarus - MacOS X - How to get available WiFi SSID's
August 21, 2016 3:03 AM
I wrote this small function to retrieve the available SSID's of WiFi access points in your area (the ones your computer can see).
Hope it's useful to someone. Note that this works on MacOS X only and that you need to add uses process to your code.
Scan WiFi network for available SSID's
Returns a string with SSID's separated by new lines
or "(no WiFi networks found)" when WiFi was disabled, unavailable or no networks were found }
var s : ansistring;
if RunCommand('/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport',['-s'],s) and (s<>'') then
if dataText.Count>0 then
cutOffPosition:=pos(' BSSID',dataText.Strings)-1; // BSSID is lined up with the end of SSID
for Counter:=0 to dataText.Count-1 do
dataText.Delete(0); // first line is just a header
if s='' then s:='(no WiFi networks found)';
GetAvailableWiFiSSIDs := s;