Get Local/Gateway IP Addresses
strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set IPConfigSet = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration") For Each IPConfig in IPConfigSet If Not IsNull(IPConfig.IPAddress) Then For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress) If Not (IPConfig.IPAddress(i)="0.0.0.0") Then IPAddr = IPAddr + IPConfig.IPAddress(i) + vbNewLine End If Next End If If Not IsNull(IPConfig.DefaultIPGateway) Then For i=LBound(IPConfig.DefaultIPGateway) to UBound(IPConfig.DefaultIPGateway) If Not (IPConfig.DefaultIPGateway(i)="0.0.0.0") Then IPGate = IPGate + IPConfig.DefaultIPGateway(i) + vbNewLine End If Next End If Next app.scriptArgs.SetValue "myIP", IPAddr app.scriptArgs.SetValue "myGATE", IPGate
app.doScript(File(app.activeScript.path+'/GetMyIP.vbs'), ScriptLanguage.visualBasic); var myIP = app.scriptArgs.getValue("myIP"); var myGateway = app.scriptArgs.getValue("myGATE");
So, we call doScript and point it to file we created earlier, and important thing is to set script language (ScriptLanguage.visualBasic). After command is executed, we can read scriptArgs, and if everything went ok, we got our IP addresses. I hope it will work for you! It would be nice to receive some feedback
This script is tested on InDesign CS4/CS5 on Windows 7, and I will test it on CS5/WinXP later.