IBM Support

Getting the local network IP address using a Robot Functional Test

Technote (FAQ)


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


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")<>""



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

    Do Until EOF(1)

        Line Input #1, l$

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


            MsgBox ip$            

        End If    


    Close #1

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


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.

Document information

More support for: Rational Robot

Software version: 7.0.3,,,,,,,,,

Operating system(s): Windows

Reference #: 1171743

Modified date: 13 December 2012