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$.
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:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.