How to best get data from this text file Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
philly

How to best get data from this text file  Topic is solved

13 Aug 2018, 20:12

example of text file

Code: Select all

 
Interface name : WiFi 
There are 3 networks currently visible. 

SSID 1 : 22563Y22TR
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP 

SSID 2 : JIMB_99855
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP 

SSID 3 : 263_63c868
    Network type            : Infrastructure
    Authentication          : WPA2-Personal
    Encryption              : CCMP 
I want just the network names
22563Y22TR
JIMB_99855
263_63c868

Help me get this information please
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: How to best get data from this text file

14 Aug 2018, 03:22

using a regexmatch while loop to parse multiline data. search for the SSID # : string, discard it, then grab everything until the end of the line

Code: Select all

haystack = 
(LTrim
	Interface name : WiFi 
	There are 3 networks currently visible. 

	SSID 1 : 22563Y22TR
	    Network type            : Infrastructure
	    Authentication          : WPA2-Personal
	    Encryption              : CCMP 

	SSID 2 : JIMB_99855
	    Network type            : Infrastructure
	    Authentication          : WPA2-Personal
	    Encryption              : CCMP 

	SSID 3 : 263_63c868
	    Network type            : Infrastructure
	    Authentication          : WPA2-Personal
	    Encryption              : CCMP 
)

Pos := 1, needle := "`am)SSID \d+ : \K.*$"
while(Pos := RegExMatch(haystack, needle, M, Pos + StrLen(M)))
	output .= M "`n"

MsgBox % output

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], mikeyww and 191 guests