Find your IP4 Address for Windows systems. (See the caution at the top of the code).
Edit: There may be a language difference that prevents the search match. The routine is not case-sensitive, but see, "search$= " for supported search terms.
Pete
Edit: There may be a language difference that prevents the search match. The routine is not case-sensitive, but see, "search$= " for supported search terms.
Code: (Select All)
' CAUTION - THE SHELL STATEMENT WILL OVERWRITE ANY PREEXISTING FILE YOU HAVE IN YOUR LOCAL DIRECTORY NAMED "tmp.tmp".
' Change tmp.tmp to something else if that's a problem.
SHELL _HIDE "ipconfig>tmp.tmp"
OPEN "tmp.tmp" FOR BINARY AS #1
a$ = SPACE$(LOF(1))
GET #1, , a$
CLOSE #1
DO
j = INSTR(LCASE$(a$), search$)
IPAddy$ = MID$(a$, j)
IPAddy$ = MID$(IPAddy$, 1, INSTR(IPAddy$, CHR$(13)) - 1)
IPAddy$ = _TRIM$(MID$(IPAddy$, INSTR(IPAddy$, ":") + 1))
IF j AND LEN(search$) > 0 THEN
PRINT "Your IP Address is: "; IPAddy$
EXIT DO
ELSE
SELECT CASE cnt
CASE 0
search$ = "ipv4 address"
CASE 1
search$ = "ip address"
CASE 2
search$ = "ipv4 "
CASE 3
search$ = "ipv4-address"
CASE 4
search$ = "ip-address"
CASE 5
search$ = "ipv4-"
CASE ELSE
PRINT "Sorry, can't find IP addy. Opening Notepad so you can find it..."
SHELL _DONTWAIT "Notepad tmp.tmp"
EXIT DO
END SELECT
END IF
cnt = cnt + 1
LOOP
Pete