how i get system ip address using macro in openoffice

How do i get my system’s IP address using a macro in LibreOffice (or OpenOffice)?

But you already know that you are here on the LibreOffice site?

I suspect this might depend on your OS. What OS are you using?

**For Windows: ** See How to get the stdout result of a Basic "shell" order?.
The relevant functionality is contained in the function ShellRun() there.

Sub TestShellRun
    msgbox ShellRun("cmd.exe /c dir")
End Sub


Function getCommandOutput(pCommand)
  getCommandOutput = ShellRun("cmd.exe /c " & pCommand)
End Function

and call the function with pCommand = “ipconfig”.
You need to analyse the result for the ip you want.

aSplit = Split(getCommandOutput("ipconfig"), Chr(10))

will return the array of output lines where you find everything you need.
Just tidy up the mess made of the output by silly locaization.

Just tidy up the mess made of the output by silly locaization

… or issue chcp 1252 prior to ipconfig, to ensure en_US output:

cmd.exe /c chcp 1252 & ipconfig

Unfortunately thats not much better. Why are MS making such a mess of anything (align with spaces, lots of useless interlines e.g by cmd.exe, multiline “info” in explorer…) instead of producing clearly structured output. Are they interested in actively keep users sillydumb and taking this nonsense as “state of the art”?
(Like this “forum” using one of the worst date formats imaginable.)