Day 025: _CLIPBOARD$
#2
Find your IP Address for Windows systems. (See the caution at the top of the code). English and German, apparently supported.

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
Reply


Messages In This Thread
Day 025: _CLIPBOARD$ - by Pete - 12-06-2022, 06:34 AM
RE: Day 025: _CLIPBOARD$ - by Pete - 12-11-2022, 05:38 PM
RE: Day 025: _CLIPBOARD$ - by mnrvovrfc - 12-11-2022, 06:45 PM
RE: Day 025: _CLIPBOARD$ - by Pete - 12-11-2022, 07:00 PM



Users browsing this thread: 1 Guest(s)