local IP-Adress

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
migro
Macro Veteran
Posts: 152
Joined: Thu Nov 06, 2003 5:23 pm
Location: Germany
Contact:

local IP-Adress

Post by migro » Sat Mar 13, 2004 3:11 am

Hi there,

does anybody knows a solution to readout a computers local IP-Adress with a scriptcommand?

:cry:

thanks
migro
regards
migro

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Mar 13, 2004 4:19 am

You can read iit from a Registry Key, I just don't recall the path to locate it. And I believe that the path depends on the OS.

Here is the command:
RegistryReadKey>root_key,key,entry,result_variable

Here is a path from a WIN98SE:
HKLM\System\CurrentControlSet\Services\Class\NetTrans\0000

The root_key is "HKEY_LOCAL_MACHINE
The key is "System\CurrentControlSet\Services\Class\NetTrans\0000"
The entry is "IPAddress"

But the last section of the key "0000" really depends on another Registry setting. There can be more than one folder under NetTrans. You need to go to another key first to locate the default that you need to open.

I think you will find that information under NetClient vs. NetTran.

So you would first Read the Registry under NetClient and get the value of the NetTrans\SubName.. I think the value is in the key for Default. Make that value a varialble in place of the "0000".

Then Read the Registry againg using that variable on the end of the root key

Sorry I can't be more specific, but perhaps you already know the Registry values to look for, or someone else on the forum will come through with the specifics.

There may only be one value under NetClient, in which case the original path I provided may work without any additional coding.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Sat Mar 13, 2004 2:53 pm

Let>RP_WAIT=1
Run Program>CMD /C ipconfig /all > C:\MyLocalIP.txt
Execute File>C:\MyLocalIP.txt

User avatar
migro
Macro Veteran
Posts: 152
Joined: Thu Nov 06, 2003 5:23 pm
Location: Germany
Contact:

good idea

Post by migro » Sat Mar 13, 2004 11:39 pm

Lumumba wrote:Let>RP_WAIT=1
Run Program>CMD /C ipconfig /all > C:\MyLocalIP.txt
Execute File>C:\MyLocalIP.txt
gave me the right idea to get the data I need


Label>GetIP
Run Program>cmd /c ipconfig > C:\ip.txt
Let>IPFile=C:\ip.txt
ReadLn>IPfile,8,line
MidStr>%line%,45,15,IPline
If>%IPline%IPfile,9,line
MidStr>%line%,45,15,Subline
ReadLn>IPfile,10,line
MidStr>%line%,45,15,Gateline
MessageModal>%Gateline%
regards
migro

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Sun Mar 14, 2004 9:23 am

Before your Run Program line I would advise that you add Let>RP_WAIT=1. This will make sure that the script will wait for the command in the Run Program line to finish before continuing. Otherwise you could find that your text file doesn't yet exist when you start reading it. You can also hide the Run Program DOS box that appears by using Let>RP_WINDOWMODE=0:

Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Run Program>cmd /c ipconfig > C:\ip.txt
etc etc
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts