Get IP address
Hi,
How can I get the system IP address and store it in a variable ?
Harder:
Is it possible to show this IP address in a edit field in a custom page to allow the user to change it ?
Thanks,
Fabio
Archive: Get IP address
Get IP address
Hi,
How can I get the system IP address and store it in a variable ?
Harder:
Is it possible to show this IP address in a edit field in a custom page to allow the user to change it ?
Thanks,
Fabio
Thank you very much. It works fine but is it normal that the ip address is followed by ";"?
How can I remove it ?
How can I allow the user to modify this IP address in edit field?
Just remove the ";" with StrCpy
You can use InstallOptions to create a custom page with a text field.
Just remove the ";" with StrCpyI did it with the command StrCpy $0 $0 -1. But, if you know this ip.dll, will there always be a ";"?
Originally posted by Joost VerburgCan you help me more? I just begin with NSIS. How can I create a custom page with a text field containing the IP address stored in a variable $0, than store the new text of the field in another variable after the user has modified it?
You can use InstallOptions to create a custom page with a text field.
This script gives you the IP addresses for all network adapters. There can be more than one.
Read the InstallOptions documentation for details about custom pages. The Modern UI InstallOptions.nsi examples shows you how to get the value of a custom page.
To be certain you can always copy just the last character using StrCpy, check if it's a semicolon and remove it if it is.
An how can I remove all the chars from the first semicolon to the end of the string (if I want to keep only the first IP address)?
In fact I'm compeletely lost with the string functions of NSIS. Where are 'Pos', 'Copy' or 'Left', 'Right' or 'Mid'?
Left, Right, Mid etc. can al be done using StrCpy.
Left and Right OK.
But how to do with Mid?
And Pos: Should I use a loop or is there a simpler way?
For Mid, use a start_offset and a maxlen.
The NSIS manual includes string search functions.
That's great : now I can retrieve all IP adresses and display them in a combobox.
But now, I would like to select automatically the first element of the list. How can set ItemIndex=0 for the combobox?