Sub FindWiFi
Wait For (FindSSID) Complete (Result As Map)
If Result.IsInitialized Then
For i = 0 To Result.Size-1
Dim m As Map = Result.Get(Result.GetKeyAt(i))
Log(Result.GetKeyAt(i))
Log(m.Get("name"))
Log(m.Get("autentication"))
Log(m.Get("signal"))
Log(m.Get("frequency"))
Log(m.Get("channel"))
Log("----------------")
Next
End If
End Sub
Sub FindSSID As ResumableSub
Dim shl As Shell
Dim ms, mdati As Map
shl.Initialize("shl", "cmd", Array("/c", "netsh", "wlan", "show", "networks", "mode=", "Bssid"))
shl.Run(-1)
Wait For shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
If Success And ExitCode = 0 Then
ms.Initialize
Dim dati() As String = Regex.Split(Chr(10) & Chr(13), StdOut)
For i = 0 To dati.Length-1
Dim subdati() As String = Regex.Split(CRLF, dati(i))
If subdati.Length>0 Then
If subdati(1).StartsWith("SSID ") Then
mdati.Initialize
mdati.Put("name", subdati(1).SubString(subdati(1).IndexOf(":")+1).Trim)
mdati.Put("autentication", subdati(3).SubString(subdati(3).IndexOf(":")+1).Trim)
mdati.Put("signal", subdati(6).SubString(subdati(6).IndexOf(":")+1).Trim)
mdati.Put("frequency", subdati(7).SubString(subdati(7).IndexOf(":")+1).Trim)
mdati.Put("channel", subdati(8).SubString(subdati(8).IndexOf(":")+1).Trim)
ms.Put(subdati(1).SubString2(0,subdati(1).IndexOf(":")).Trim,mdati)
End If
End If
Next
End If
Return ms
End Sub