Source language: Translate to:

Mac Address

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Mac Address

Postby stevec » Thu Dec 29, 2011 8:04 am

Has anyone tried to get the 'Mac Address' off a computer system and save that to a variable?

Thanks
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Postby dec » Thu Dec 29, 2011 8:09 am

Hi stevec,

Try search the forum looking for "Mac Address" (all words), you can found some threads like this, wich offer a possible solution.
.
Enhance your NeoBook applications!
.
58 plugins, 1131 actions and 233 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Thanks

Postby stevec » Thu Dec 29, 2011 8:26 am

I have a text file that is created in C:\Windows\temp

Here is the file....

Ethernet adapter Local Area Connection 4:



Connection-specific DNS Suffix . :xxxx.LOCAL

Description . . . . . . . . . . . : Intel(R) 82567LM-3 Gigabit Network Connection

Physical Address. . . . . . . . . : 00-24-81-13-11-C0

Dhcp Enabled. . . . . . . . . . . : Yes

Autoconfiguration Enabled . . . . : Yes

IP Address. . . . . . . . . . . . : 10.220.7.30

Subnet Mask . . . . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . . . . : 10.220.7.254

DHCP Server . . . . . . . . . . . : 10.220.1.18

DNS Servers . . . . . . . . . . . : 10.215.1.42

10.215.1.43

Lease Obtained. . . . . . . . . . : Monday, December 26, 2011 10:58:41 AM

Lease Expires . . . . . . . . . . : Tuesday, January 03, 2012 10:58:41 AM

I have the following script that isolates the DHCP and writes that to a variable

***************
.........dhcp variable.........

SetVar "[DHCPFile]" "!C:\windows\temp\DHCP.txt"
FileRead "[DHCPFile]" "All" "[DHCPAll/a]"
StrParse "[DHCPAll/a]" "Dhcp Enabled" "[Item]" "[ItemCount]"
If "[Item2]" ">=" ". . . . . . . . . . . : Yes"
StrParse "[Item2]" "Autoconfiguration Enabled" "[unused]" "[junk]"
.StrParse "[Item2]" "IP Address" "[unused]" "[junk]"
StrReplace "[unused1]" "[#13][#10]" "" "[unused1]"
StrReplace "[unused1]" "[#58]" "" "[unused1]"
StrReplace "[unused1]" "[#32]" "" "[unused1]"
StrReplace "[unused1]" "[#13]" "" "[unused1]"
StrReplace "[unused1]" "[#46]" "" "[DHCP]"

****************************

I would like to do the same with the 'Physical address', and that is what I am having an issue with.
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho

Re: Thanks

Postby dpayer » Thu Dec 29, 2011 9:20 am

stevec wrote:I have a text file that is created in C:\Windows\temp

Here is the file....

Ethernet adapter Local Area Connection 4:



Connection-specific DNS Suffix . :xxxx.LOCAL

Description . . . . . . . . . . . : Intel(R) 82567LM-3 Gigabit Network Connection

Physical Address. . . . . . . . . : 00-24-81-13-11-C0

I would like to do the same with the 'Physical address', and that is what I am having an issue with.


Try something like this:

Code: Select all
SearchStr "Physical Address. . . . . . . . . : " "[DHCPFile]" "[MACstart]" ""
SubStr "[DHCPFile}" "[MACstart] + 36" "17" "[MacAddress]"


Check the spacing of the plus sign when you add 36 to the variable [MACstart]. It may need to be adjacent: [MacStart]+36

David P.
User avatar
dpayer
 
Posts: 1382
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

I use this

Postby virger » Thu Dec 29, 2011 9:26 am

Copy to a Button
--------------------

{NeoBook 5 Objects}
NeoBookVer=5.70
ObjectType=3
Name=Mac
X=408
Y=303
W=52
H=36
Anchor=0
Text=Mac
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=filewrite "Mac.bat" "All" "ipconfig/all > Mac.bat"¶Run "Mac.bat" "RunOnce+Wait+LoadComplete" "RunOnce+Wait+LoadComplete+Minimized+Hidden" "" ""¶fileread "[PubDir]Mac.bat" "All" "[mac]"¶strparse "[mac]" "Physical Address. . . . . . . . . : " "[mac]" "[x]"¶substr "[mac2]" "1" "17" "[mac]"¶setvar "[mac1]" ""¶setvar "[mac2]" ""¶fileerase "Mac.bat"¶alertbox "My MAC" "[mac]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=22
---------------

FELIZ AÑO 2012
DESDE COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 518
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Postby stevec » Thu Dec 29, 2011 10:37 am

Many thanks;
I got it.

SearchStr "Physical Address. . . . . . . . . :" "[DHCPAll/a]" "[MACstart]"
SubStr "[DHCPAll/a]" "[MACstart] + 36" "17" "[MacAddress]"

Way cool, you guys are the best!!!!!!!!!
:P :P :P :P :P :P :P :P :P :P :P
Steve Christensen
stevec
 
Posts: 223
Joined: Fri Apr 15, 2005 7:33 am
Location: Boise, Idaho


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest