Source language: Translate to:

PC - IP address

Questions and information about creating Internet aware NeoBook applications. Including PHP, HTML, FTP, HTTP, Email, etc.

Moderator: Neosoft Support

Postby Neosoft Support » Thu Aug 19, 2010 10:12 am

Basically all the function does is run a Windows utility called "ipconfig" output the results to a text file which is then parsed. The incorrect results look like a problem with the parsing.

You could do something similar without VBScript by using NeoBook's Run action to execute ipconfig and parsing the results yourself.
NeoSoft Support
Neosoft Support
NeoSoft Team
Posts: 5620
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Tony Kroos » Fri Oct 01, 2010 10:13 pm

it is not a parsing problem. your computer has many network "ip-enabled" system devices with different parameters, you just need to pick the right one. try this function:

Code: Select all
On Error Resume Next
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
For Each IPConfig in IPConfigSet
    If Not IsNull(IPConfig.IPAddress) Then
        IPAddr = Filter(IPConfig.IPAddress, ":", False, 1)
        nbSetVar "[IP]", IPAddr(0)
    End If

Copy this to neobook function editor as VBScript, save and call. Ip will be stored in [IP] variable. In case of any errors [IP] will be empty.
Tony Kroos
Posts: 405
Joined: Thu Oct 15, 2009 3:43 pm

Postby Jay-Bird » Fri Oct 01, 2010 11:35 pm

Thats a nice tidbit ... Thank you!
User avatar
Posts: 164
Joined: Fri Apr 01, 2005 7:01 am
Location: Louisiana , USA

Postby Tony Kroos » Sat Oct 02, 2010 2:51 am

thanks, if you are interested in this I could post more great vbs/js functions for neobook, just ask... :wink:
Tony Kroos
Posts: 405
Joined: Thu Oct 15, 2009 3:43 pm

Return to NeoBook and the Internet

Who is online

Users browsing this forum: No registered users and 1 guest