Skip to content
⌘ NSIS Forum Archive

Inputbox

10 posts

Tupsan#

Inputbox

Hi,

I created a program that allows me to install several applications with NSIS. The only thing missing is an input box. What I want to do is the following. I would like to get an input box where the user can give his initials max 2 characters. when the users enters his code I need the program to write this code to a file or directly to the database. When I use the command "alter.exe c:\test "yyy" "xxx" I can change yyy into xxx. I would like this to be done by the program. Is there a code to do this.

Thx

Tupsan.
Comperio#
Look at the DialogsEx plugin here:


The same link is also listed on the author's Wiki page here: http://nsis.sourceforge.net/wiki/Dialogs
Tupsan#
Inputbox

Hi,

I created the inputbox an it works. What I don't get is the following. When I enter something in this inputbox where can I find my input. What I need to do is:

1. copy files form one location to another
2. open an inputbox
3. user has to enter his initials
4. initials needs to be written to a file or to a database.

The code that I have is teh following.

SectionGroup "Fruits"

Section /o "Apple"

SetOutPath "xxxxxxxxxx"
CreateDirectory xxxxxxxxxx
File /r xxxxxxxxxx\*.*

SectionEnd

Section ""
DetailPrint "Initials"
Dialogs::InputBox "initials" "Enter Initials" "OK" "" "0" {VAR_0}
OK:
DetailPrint "User info: $0"
goto Exit
Exit:
SectionEnd

Can someone please show me hou I can do it to enter initials and to write these to a file or database.
r2du-soft#
hi
in Dialogs::InputBox what is ok id and cancell id?

for example my code is:

Dialogs::InputBox "PasswordBox" "Please enter the password:" "OK" "Cancel" "0" ${VAR_5}
now i have two question:


1-Ok haven't id?!
for example we can set for Ok goto and cancell goto!
Section
MessageBox MB_OKCANCEL "is it true?" IDOK true IDCANCEL false
true:
my codes
goto end

false:
abort
goto end

end:
SectionEnd
we can't set like that in Dialogs::InputBox?!

sample like this:

Dialogs::InputBox "PasswordBox" "Please enter the password:" "OK" true "Cancel" false "0" ${VAR_5}

2-now "0" what is?
Anders#
Originally Posted by r2du-soft View Post
i how can understand user click on button 1(ok) or button2(cancel)?
Did you look at InputBox.nsi in the zip file? Always check the plugin documentation and examples before asking these type of questions.
r2du-soft#
Originally Posted by Anders View Post
Did you look at InputBox.nsi in the zip file? Always check the plugin documentation and examples before asking these type of questions.
thanks mr Anders
but i always before asking question searching and i see examples,yes some times i cant find examples because i bad search and my english so bad... really im sorry for creation this problems.
i before ask this question searching and see InputBox.nsi example,but i this that is a problem and must create a lot change that....
please test this... compile InputBox.nsi and run that exe file,when see input box no write any text in text box and just click on ok,see program run cancel codes!


please test codes:
!include "defines.nsh"
!include "MUI.nsh"
ShowInstDetails nevershow
ShowUninstDetails nevershow
XPStyle on
Page instfiles


!define PSD "pass"


Section
Again:
StrCpy $R2  ""
DetailPrint "Executing plugin...."
Dialogs::InputBox "InputBox sample" "Please type password to continue..." "OK" "Cancel" "0" ${VAR_R2}
StrCmp $R2 "" Cancel Ok


Cancel:
SetDetailsPrint both
DetailPrint "Cancel by user..."
SetDetailsPrint none
goto Exit

Ok:
SetDetailsPrint both
DetailPrint "User info: $R2"
SetDetailsPrint none


${If} "$R2" == "${PSD}"
SetDetailsPrint both
DetailPrint "Password is true,Welcome to application."
SetDetailsPrint none
MessageBox MB_OK|MB_ICONINFORMATION "Password is true,Welcome to application."
Goto Exit
${EndIf}

StrLen $0 "$R2"
${If} "$0" > "25"
MessageBox MB_OK|MB_ICONINFORMATION "You entered $0 character,Maximum password length is limited to 25 character."
Goto Again
Abort
${EndIf}

${If} "$R2" == ""
MessageBox MB_OK|MB_ICONINFORMATION "Please enter a password to continue..."
Goto Again
Abort
${EndIf}

${If} "$R2" != "${PSD}"
MessageBox MB_OK|MB_ICONSTOP "The password '$R2' is correct!"
Goto Again
Abort
${EndIf}


Exit:
SectionEnd
in this codes when see textbox just click on ok and see cancel codes run!
this is my problem.....


i think this problem just solve when the we have a return value and undrestand user click on which button for example when user click on button1 (Ok) we return value back 1 and when user click on button2 (Cancel) we return value back 2...then we can use from if
(Sample:
if $0 == 1 messagebox "User click on Ok button" now run other code
if $0 == 2 messagebox "User click on Cancel button" then exit or run other code
)
r2du-soft#
Originally Posted by Anders View Post
Why is empty text = cancel a problem when you seem to require a non-empty password?
yes,because if i change *StrCmp $R2 "" Cancel Ok* TO *StrCmp $R2 "pass" Cancel Ok* then i cant set check limit character or check password wrong or.... for check this items i set StrCmp = empty...
now i how can fix this problem? Ok button or Cancel button haven't return value?!
what is the best way for solve that problem with set check limit character and check wrong password...?
thanks