Getting the local network IP address using a Robot Functional Test

Technote (FAQ)


Question

How do you create an IBM Rational Robot Functional script that obtains the local IP address?

Answer

Follow these steps to make a script that will identify the local IP address.

1) Create a batch file that calls the Windows IPCONFIG Utility.


    Use a text editor like NotePad and create a file called ip.bat.

    Include in the file the following line:
    ipconfig > c:\ip.txt
    Save this file to the root of the C: drive.


2) Then add the following code to your script:.
   
Dim Result As Integer

    Dim l$, ip$

    Result = Shell("C:\ip.bat")

   

    Do Until Dir("C:\ip.txt")<>""

    Loop

   

    Open "C:\ip.txt" For Input As #1

    Do Until EOF(1)

        Line Input #1, l$

        if InStr(l$,"IP Address") Then

            ip$=Trim$(Mid$(l$,InStr(l$,":")+1))

            MsgBox ip$            

        End If    

    Loop

    Close #1

This will save the IP Address in the variable called ip$.


Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational Robot
Scripting

Software version:

7.0.3, 7.0.3.1, 7.0.3.2, 7.0.3.3, 7.0.3.4, 7.0.3.5, 7.0.3.6, 7.0.3.7, 7.0.3.8, 7.0.3.9

Operating system(s):

Windows

Reference #:

1171743

Modified date:

2012-12-13

Translate my page

Machine Translation

Content navigation