Code: Select all
Procedure.s CLIreturn(prg.s, comando.s)
Protected salida.s
comando = ReplaceString(comando,"'",Chr(34))
idprg= RunProgram(prg, comando, GetPathPart(prg), #PB_Program_Open|#PB_Program_Read|#PB_Program_Error|#PB_Program_Hide)
If IsProgram(idprg)
While ProgramRunning(idprg)
If AvailableProgramOutput(idprg)
salida + ReadProgramString(idprg) + #CRLF$
EndIf
error$ = ReadProgramError(idprg)
If error$ <> ""
salida + error$ + #CRLF$
EndIf
Wend
EndIf
ProcedureReturn salida
EndProcedure
Procedure.s netGetRedes()
Protected.s o, router, ll, l= CLIreturn("cmd","/c netsh wlan show profiles")
Protected n, p= FindString(l," : ")-Len(" : ")
l= ReplaceString(l,Chr(10),"")
For p=10 To CountString(l,Chr(13))-1
router= StringField(StringField(l,p,Chr(13)),2,": ")
ll= CLIreturn("cmd","/c netsh wlan show profile name="+router+" key=clear")
ll= ReplaceString(ll,Chr(10),"")
For n= 1 To CountString(ll,Chr(13))-1
If n=33
o+ router+" : "+StringField(StringField(ll,n,Chr(13)),2,": ") + Chr(13)
EndIf
Next n
Next p
l= CLIreturn("cmd","/c netsh wlan show interfaces")
For n=1 To CountString(l,Chr(13))-1
If FindString(StringField(l,n,Chr(13)),"SSID :")
ll= "NETWORK : "+StringField(StringField(l,n,Chr(13)),2,": ") + Chr(13)
EndIf
Next n
ProcedureReturn ll+o
EndProcedure
MessageRequester("REDES INFO - minimy 2024", netGetRedes(),#PB_MessageRequester_Info)