View Full Version : Get IP address
12th December 2003, 14:29
How can I get the system IP address and store it in a variable ?
Is it possible to show this IP address in a edit field in a custom page to allow the user to change it ?
12th December 2003, 15:06
14th December 2003, 17:00
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?
14th December 2003, 17:03
Just remove the ";" with StrCpy
14th December 2003, 17:11
You can use InstallOptions to create a custom page with a text field.
14th December 2003, 17:43
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 Verburg
You can use InstallOptions to create a custom page with a text field. Can 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?
14th December 2003, 18:03
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.
14th December 2003, 18:09
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.
14th December 2003, 18:13
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'?
14th December 2003, 19:18
Left, Right, Mid etc. can al be done using StrCpy.
14th December 2003, 19:20
Left and Right OK.
But how to do with Mid?
And Pos: Should I use a loop or is there a simpler way?
14th December 2003, 19:24
For Mid, use a start_offset and a maxlen.
The NSIS manual includes string search functions.
14th December 2003, 21:58
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?
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.