'GetMac v2.0
'Written by David McDermott 4/2013
'Copyright K-2 Computers - Anchorage, AK
'www.k-2computers.com
'may not be used in part or whole for commercial (for profit) purposes
'any other use requires permission from the author
'
'gets mac address from host computer and passes value back to quick basic
'in string format variable "mac$", you can then call the mac$ variable when
'you need the value of the MAC address.
'
CLS
'
'
DIM m(500) AS STRING
OPEN "mac.txt" FOR INPUT AS #1
n = 21
WHILE NOT EOF(1)
INPUT #1, m$(n)
all$ = all$ + m$(n)
n = n + 1
WEND
CLOSE #1
KILL "mac.txt"
n = 1
DO WHILE n < 500
flag$ = MID$(all$, n, 16)
'PRINT flag$: SLEEP 1
IF flag$ = "Physical Address" THEN GOTO foundflag
n = n + 1
LOOP
PRINT "no MAC found": END
foundflag:
'add 20 to n and capture mac$ (17)
capturedmac = n + 37
DO WHILE n < capturedmac
all$ = all$ + m$(n)
mac$ = MID$(all$, n, 17)
n = n + 1
LOOP
PRINT "Physical address of local network interface is: "; mac$
OPEN "save.txt" FOR INPUT AS #1
INPUT #1, value$
CLOSE #1
KILL "save.txt"
value = VAL(value$)
IF value <> 1 THEN END
OPEN "mac.txt" FOR OUTPUT AS #1
WRITE #1, mac$
CLOSE #1

