Hola chicos esta funcion sirve para mostrar con un Dialog.Message las personas que estan conectados en la red Wi-Fi. Dentro de la funcion tiene una pequeña lista de MACs para saber de la que marca es el dispositivo que esta conectado.


function Clients_Connected()
--Crear un archivo BAT con la información siguiente.
TextFile.WriteFromString(_SystemFolder.."\\Temp\\script.bat", "del Cliente.txt /S\r\ndel TCliente.txt /S\r\nnetsh.exe wlan show hostednetwork >> ".."Cliente.txt", false);
-- Luego se ejecuta y generará un archivo TXT con la información que nos dará del comando "netsh show hostednetwork"
File.Run(_SystemFolder.."\\Temp\\script.bat", "", _SystemFolder.."\\Temp", SW_HIDE, true);
-- Lo Leemos y reemplazados datos innesesarios para poder limpiarlo y obtener lo necesario
s1 = TextFile.ReadToString(_SystemFolder.."\\Temp\\Cliente.txt");
s2 = String.Replace(s1, "Configuraci¢n de red hospedada", "Configuración de red hospedada", false);
s3 = String.Replace(s2, "N§ m ximo de clientes", "No máximo de clientes", false);
s4 = String.Replace(s3, "Autenticaci¢n", "Autenticación", false);
s5 = String.Replace(s4, "N£mero de clientes", "Número de clientes", false);
File.Delete(_SystemFolder.."\\Temp\\Clients.text");
TextFile.WriteFromString(_SystemFolder.."\\Temp\\Cliente.txt", s5, false);
TempFile = TextFile.ReadToString(_SystemFolder.."\\Temp\\Cliente.txt");
clients = "Estado de la red hospedada"
text = String.Find(TempFile, "Número de clientes :", 1, false);
strEnd = String.Mid(TempFile, text, -1);
new1 = String.Replace(strEnd, " \n", "", false);
new2 = String.Replace(new1, "Número de clientes : ", "", false);
new3 = String.Replace(new2, "Autenticado", "", false);
new4 = String.Replace(new3, " ", "", false);
-- Luego de borrar y reemplazar strings guardamos lo que quedo y leemos en forma de tabla porque la información
-- que queda se ve en forma de columna.
TextFile.WriteFromString(_SystemFolder.."\\Temp\\TCliente.txt", new4, false);
new5 = TextFile.ReadToTable(_SystemFolder.."\\Temp\\TCliente.txt");

---------------------------------------------------------------------------------------------------------------
------------------------ PEQUEÑA TABLA DE MAC DE DISPOSITIVOS MOVILES PARA IDENTIFICAR ------------------------
---------------------------------- EN EL CUAL SE PUEDE AGREGAR MUCHOS MÁS -------------------------------------

mac_table = {"00:00:4C NEC","00:00:95 Sony","00:00:F0 Samsung","00:01:4A Sony","00:02:6C Philips","00:02:78 Samsung",
"00:02:EE Nokia","00:03:93 Apple","00:03:FF Microsoft","00:04:1F Sony","00:04:6B Palm","00:05:02 Apple","00:05:4E Philips",
"00:05:C9 LG","00:07:72 Alcatel","00:07:AB Samsung","00:07:E0 Palm","00:08:62 NEC","00:08:9A Alcatel","00:08:C6 Philips",
"00:09:18 Samsung","00:09:2D HTC","00:09:5C Philips","00:09:FB Philips","00:0A:27 Apple","00:0A:28 Motorola","00:0A:95 Apple",
"00:0A:D9 Sony Ericsson","00:0A:D9 Sony","00:0B:E1 Nokia","00:0C:36 Sharp","00:0D:02 NEC","00:0D:3A Microsoft","00:0D:5E NEC",
"00:0D:93 Apple","00:0D:AE Samsung","04:E5:36 Apple","04:F1:3E Apple","04:F7:E4 Apple","04:F9:38 Huawei","04:FE:31 Samsung",
"08:00:07 Apple","08:00:1F Sharp","08:00:3E Motorola","08:00:46 Sony","08:00:6F Philips","08:08:C2 Samsung","08:18:1A ZTE",
"08:19:A6 Huawei","08:37:3D Samsung","08:3D:88 Samsung","08:63:61 Huawei","0C:12:62 ZTE","0C:14:20 Samsung","0C:15:39 Apple",
"0C:1D:AF Xiaomi","0C:30:21 Apple","0C:37:DC Huawei","0C:3E:9F Apple","0C:4D:E9 Apple","0C:71:5D Samsung","0C:74:C2 Apple",
"0C:77:1A Apple","0C:89:10 Samsung","0C:96:BF Huawei","10:00:E0 Apple","10:0E:2B NEC","10:1B:54 Huawei","10:1C:0C Apple",
"10:1D:C0 Samsung","10:2F:6B Microsoft","10:30:47 Samsung","10:F9:6F LG","10:F9:EE Nokia","14:10:9F Apple","14:1A:A3 Motorola",
"14:30:C6 Motorola","14:36:05 Nokia","14:36:C6 Lenovo","14:49:E0 Samsung","14:5A:05 Apple","14:60:80 ZTE","14:89:FD Samsung",
"14:8F:C6 Apple","14:99:E2 Apple","18:00:2D Sony","18:14:56 Nokia","18:1E:B0 Samsung","18:20:32 Apple","18:22:7E Samsung",
"18:26:66 Samsung","18:34:51 Apple","18:3A:2D Samsung","1C:08:C1 LG","1C:1A:C0 Apple","1C:1D:67 Huawei","1C:5A:3E Samsung",
"1C:5A:6B Philips","1C:62:B8 Samsung","1C:66:AA Samsung","1C:7B:21 Sony","1C:8E:5C Huawei","1C:AB:A7 Apple","1C:AF:05 Samsung",
"1C:B0:94 HTC","1C:B1:7F NEC","1C:E6:2B Apple","20:08:ED Huawei","20:0B:C7 Huawei","20:13:E0 Samsung","20:21:A5 LG","20:2B:C1 Huawei",
"20:54:76 Sony","20:62:74 Microsoft","20:64:32 Samsung","20:6E:9C Samsung","20:76:93 Lenovo","20:7D:74 Apple","20:89:86 ZTE",
"20:A2:E4 Apple","20:A9:9B Microsoft","20:C9:D0 Apple","20:D3:90 Samsung","20:D5:BF Samsung","20:D6:07 Nokia","20:F3:A3 Huawei",
"24:09:95 Huawei","24:21:AB Sony Ericsson","24:21:AB Sony","24:26:42 Sharp","24:69:A5 Huawei","24:7F:3C Huawei","24:A0:74 Apple",
"24:F5:AA Samsung","28:0B:5C Apple","28:0D:FC Sony","28:18:78 Microsoft","28:31:52 Huawei","28:37:37 Apple","28:3C:E4 Huawei",
"28:E0:2C Apple","28:E1:4C Apple","28:E3:1F Xiaomi","28:E7:CF Apple","2C:1F:23 Apple","2C:26:C5 ZTE","50:55:27 LG","C4:43:8F LG","50:56:BF Samsung",
"50:85:69 Samsung","50:9F:27 Huawei","50:A4:C8 Samsung","50:B7:C3 Samsung","50:CC:F8 Samsung","50:EA:D6 Apple","50:F5:20 Samsung",
"50:FC:9F Samsung","F4:9F:54 Samsung","F4:9F:F3 Huawei","00:C6:94 MrTab","F4:C7:14 Huawei","F4:D9:FB Samsung","F4:DC:F9 Huawei","F4:F1:5A Apple",
"FC:F1:52 Sony"};
--------------------------------------------------------------------------------------------------------------------------------
if (new5 ~= "0") or (new5 ~= "") or (new5 ~= false) then
for j, k in pairs(new5) do
if j ~= 1 then
if k ~= "" then
mac_left = String.Left(k, 6);
p_mac = String.Upper(mac_left);
count = Table.Count(mac_table);
upper = String.Upper(k);
for o, p in pairs(mac_table) do
t_mac = String.Left(p, 6);
if t_mac == p_mac then
text = String.Find(p, t_mac, 1, false);
if text ~= -1 then
strEnd = String.Mid(p, text, -1);
lenght = String.Length(strEnd);
factory = String.Right(strEnd, lenght-9);
if upper ~= "" then
no = j-1;

Dialog.Message("Notificación", "["..no.."] Cliente: "..upper.." \r\nFabricante: "..factory.."", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

File.Delete(_SystemFolder.."\\Temp\\script.bat", false, false, false, nil);
File.Delete(_SystemFolder.."\\Temp\\Cliente.txt", false, false, false, nil);
File.Delete(_SystemFolder.."\\Temp\\TCliente.txt", false, false, false, nil);
end
end
end
end
end
end
end
end
return true;
end