plaztic
8th February 2002 11:48 UTC
Cant figure out variables
Hi,
I've been trying to figure out how to use variables with no luck.
I want to use a variable to display my program name in dialog boxes etc.
Name "My New app"
Function .onInit
MessageBox MB_YESNO "Do you want to install $R9?" IDYES NoAbort
MessageBox MB_OK "Installation canceled by user."
Abort
NoAbort:
FunctionEnd
I tried;
Section InstAppName
StrLen $R9 "My New App"
SectionEnd
The docs make no sense to me :confused: is there an NSIS for Dummies?
\plaz
petersa
8th February 2002 13:42 UTC
Try changing StrLen to StrCpy. Everything should work then!
Of course, you could do it this way, too. Put this line at the start of your script.
!Define APPNAME 'My New App'
Then when you want to refer to it, use ${APPNAME}.
MessageBox MB_YESNO 'Would you like to install ${APPNANE}?' IDYES NoAbort
You don't have to use APPNAME. Choose anything.
No NSIS for Dummies! :D Just post any problems of yours here and someone will be glad to help.
plaztic
8th February 2002 17:00 UTC
Thanks for the tip!
I'll this asap.
\plaz
plaztic
11th February 2002 08:02 UTC
Thanks Petersa,
Solved my problems. Did try this once before, but then I used NSIS 1.44 and that didn't work.
\Plaz :)
Tresni
11th February 2002 09:07 UTC
The only problem with your original script was you were using StrLen (which would return the length of a string) when you should have been using StrCpy (which copies on string into another). But I would suggest taht you keep your variables from something that is well, variable. If it's going to stay the same use a !define.. 8) Anyway.. Have fun!
glenncarr
4th June 2002 02:32 UTC
trying to define string - 'Name expects 1 parameters, got 7'
So, what am I doing wrong here...?
!Define APPNAME 'GoogleSpell Add-on for Daves Quick Search Deskbar'
Here's the script error I get...
Processing script file: "C:\glenn\dev\dqsd\addons\googlespell\googlespell.nsi"
!define: "APPNAME"="GoogleSpell Add-on for Daves Quick Search Deskbar"
Name expects 1 parameters, got 7.
Usage: Name installer_name
Error in script "C:\glenn\dev\dqsd\addons\googlespell\googlespell.nsi" on line 8 -- aborting creation process
Using v1.98
:igor:
0mar
4th June 2002 03:06 UTC
wild wild guess, but try this:
Name "${APPNAME}"
I'm thinking right now you have:
Name ${APPNAME}
Although I'm really not sure...
glenncarr
4th June 2002 05:12 UTC
Doh! :igor:
You're right. Thanks.
0mar
4th June 2002 05:27 UTC
Glad I could help. :)