Archive: Input a string


Input a string
Hello,

Is there a way to make an "InputBox" to ask user his name for example ? (As MessageBox but with a TextBox inside)

Or a page in the installer with a textBox ?

thanks


yes - look at the documentation for InstallOptions2, InstallOptionsEx, or NSDialogs (preferred). Any of those 3 let you create your own installer dialog with controls - among which is a simple text edit field where you can ask the user for a username.

There is also the PassDialog plugin:
http://nsis.sourceforge.net/PassDialog_plug-in

And Dialogs plugin:
http://nsis.sourceforge.net/Dialogs_plug-in


Hi

Thanks for your reply, that's exactly what i'm looking for.

I want to prompt the user for username and password in order to store a scheduled task.

I tried PassDialog plugin and Dialogs plugin and this is not what i want exactly (because i want it in modern ui, and i don't need to verify a password, juste write it in the scheduled task)

Anyway, i tried the NSDialogs plugin. It works, except maybe a little bug: if i put the custom page before MUI_PAGE_INSTFILES, the custom page doesn't display a "next" button, but a "install" button :s

in this order:
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
Page custom nsDialogsPage
!insertmacro MUI_PAGE_FINISH

the nsDialogsPage shows a "next" button (ok)

but in this order:
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
Page custom nsDialogsPage
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

it shows a "install" button, instead of a "next".
And i have to use this order ...

Do you have any idea to show a "next" button in the custom page ?


It's not a bug, actually... any page directly before the InstFiles page (where files actually get installed) will have the 'Next' button relabeled to 'Install'.

This is for good installer logic reasons... 'Next' tells the user they will go to the next page of settings / information. 'Install' tells the user they will actually be installing the files.

That said.. you can easily change the text on the button - see: http://nsis.sourceforge.net/Buttons_Header

Or just the code you need:


GetDlgItem $0 $HWNDPARENT 1 ; Next/Install button
SendMessage $0 ${WM_SETTEXT} 0 "STR:Next"


You'll want to put that code in after you initialize the dialog, before you show it, if I recall correctly.

perfect !

thanks a lot Animaether


Can we use your solution to change the text right to the icon ? Because in my custom page, there is still:
"Choose install location
Choose the folder in which to install etc"

which com from the previous page (MUI_PAGE_DIRECTORY)

i tried the code above with several item_id without success, any idea again ? :D

(and i swear it's my last question !!)


You mean in the top? You can change that via the MUI macros;


!insertmacro MUI_HEADER_TEXT "Title" "Description"

Do this before you open your custom dialog

nice !

thanks :)


no prob :)