Archive: Get IP address for IIS Service


Get IP address for IIS Service
I am using NSIS to install a perl program on an IIS server.

However, although on my machine, I use the standard http://127.0.0.1/ to access the website on my IIS server, a friend who wants to use the program has a different setting as he is running a separate server on his intranet.

I cannot find a means of finding this IP address in the registry which is a pain.

So, I guess I need to prompt the user to enter the IP address on installing the program (unless anyone has a better idea).

Does anyone know of a reliable code to enter an IP address? I have searched the archive, but to no avail.

Also, I have created a simple .ini file to display the prompt, but cannot get it to display:


( in main section I have included)
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "E:\license.txt"

; Need to read IP address
Page custom SetIP "ValidateIP" "Set your IP Address"

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

(and then later on included)

.
.
.
.
.
Function SetIP

;Display the InstallOptions dialog
InstallOptions::dialog "$PLUGINSDIR\IP.ini"

!insertmacro MUI_HEADER_TEXT "Select IP Address" "Enter the IP Address of your server\n(Default 127.0.0.1)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "$PLUGINSDIR\IP.ini"
!insertmacro MUI_INSTALLOPTIONS_READ $varCustomerIP "$PLUGINSDIR\IP.ini" "Field 1" "State"
; Temporary fix
StrCpy $varCustomerIP "127.0.0.1"

FunctionEnd


Hi rwap :)

To check your IP adress you could use this code written by 'Smile2Me':

http://nsis.sourceforge.net/archive/....php?pageid=60



About the dialog that does not display:

Have you extracted your INI file into the plugins directory ? Otherwise add this bit of code in the '.onInit' function, after the instruction 'InitPluginsdir'.

!insertmacroMUI_INSTALLOPTIONS_EXTRACT_AS"$YOU_PATH\\IP.ini""IP.ini"


evilO/Olive

PS: welcome to the forums !

Thanks for the pointers.

Alas, I had already tried the script by Smile2Me which you suggested, and once I converted it to run properly (ie. did not use test data), it does not return anything on my machine !!

I have however now got my page displaying asking the user to enter the IP address of their server. I just now need to come up with some code to validate the string returned !


Use the NSIS string functions.


once I converted it to run properly (ie. did not use test data)
Of course in your case you'll have to slightly modify the code, and you won't need the function 'GetNextIP'.

it does not return anything on my machine !!
Err, how come? :confused: Which function did you try to use? I do use a modified version of this code, it's working fine!

evilO/Olive