Find information about current wlan connection

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 998
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Find information about current wlan connection

Post by Grovkillen » Wed Apr 01, 2020 8:01 am

Code: Select all

Let>RP_WAIT=1
  MidStr>%SCRIPT_DIR%,0,1,VOLUME_LETTER
    IfFileExists>%SCRIPT_DIR%\current_wlan.txt
      DeleteFile>%SCRIPT_DIR%\current_wlan.txt
    Endif>
    Let>COMMAND_LINE_STRING=cmd /c %VOLUME_LETTER%: & cd "%SCRIPT_DIR%" & netsh wlan show interfaces > "current_wlan.txt"
    RunProgram>COMMAND_LINE_STRING
    ReadFile>%SCRIPT_DIR%\current_wlan.txt,TEMP_WLAN_INFO
    IfFileExists>%SCRIPT_DIR%\current_wlan.txt
      DeleteFile>%SCRIPT_DIR%\current_wlan.txt
    Endif>
    Let>REGEX_PATTERN=(?<=    ).+?(?=\n)
    RegEx>REGEX_PATTERN,TEMP_WLAN_INFO,0,INFO,INFO_n,0,,
    Let>k=0
    Repeat>k
      Let>k=k+1
      Let>TEMP_ROW=INFO_%k%
      Separate>TEMP_ROW, : ,TEMP_INFO
      Trim>TEMP_INFO_1,TEMP_INFO_VAR
      RegEx> ,TEMP_INFO_VAR,0,,,1,_,TEMP_INFO_VAR
      Trim>TEMP_INFO_2,TEMP_INFO_VAL
      Let>WLAN_%TEMP_INFO_VAR%=%TEMP_INFO_VAL%
    Until>k=INFO_n
This will populate the following variables:

Code: Select all

WLAN_GUID
WLAN_NAME
WLAN_DESCRIPTION
WLAN_SSID
WLAN_STATE
WLAN_PHYSICAL_ADDRESS
WLAN_BSSID
WLAN_TRANSMIT_RATE(MBPS)
WLAN_RECEIVE_RATE_(MBPS)
WLAN_HOSTED_NETWORK_STATUS
WLAN_WLAN_PROFILE
WLAN_SIGNAL
WLAN_AUTHENTICATION
WLAN_RADIO_TYPE
WLAN_CHANNEL
WLAN_CONNECTION_MODE
WLAN_CIPHER
Let>ME=%Script%

Running: 15.0.24
version history

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts