All pastes #2133666 Raw Edit

Miscellany

public text v1 · immutable
#2133666 ·published 2012-03-29 23:50 UTC
rendered paste body

IP = GetIP()
MsgBox("Your original IP is: " & IP & "")
arrOctets = Split(IP, ".")
secondOctet = InputBox("What would you like to change the second octet to")
NewAddress = arrOctets(0) & "." & secondOctet & "." & arrOctets(2) & "." & arrOctets(3)
MsgBox("Your new IP is: " & newAddress & "")   




Function getIp()
Set objShell = CreateObject("WScript.Shell")	
Set objWshScriptExec = objShell.Exec("ipconfig")	
Set objStdOut = objWshScriptExec.StdOut	
bFound = False	
iCount = 0	
While Not objStdOut.AtEndOfStream	   
strLine = objStdOut.ReadLine	   
If InStr(strLine,"Ethernet adapter Local Area Connection:") Or bFound = True Then
iCount = iCount + 1		   
ReDim Preserve aData(iCount)		   
aData(iCount) = strLine		   
bFound = True	   
End If	
Wend	
For i  = LBound(aData) To UBound(aData)	
If Instr(aData(i),"IP Address") > 0 Then			
iStartPos = Instr(aData(i),":")			
localIP = Trim(Mid(aData(i),iStartPos + 1,Len(aData(i))))			
Exit For		
End If	
Next	
Erase aData	
GetIp = localIP
End Function