Archive: Cant figure out variables


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


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.

Thanks for the tip!

I'll this asap.

\plaz


Thanks Petersa,

Solved my problems. Did try this once before, but then I used NSIS 1.44 and that didn't work.

\Plaz :)


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!


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:


wild wild guess, but try this:

Name "${APPNAME}"

I'm thinking right now you have:

Name ${APPNAME}

Although I'm really not sure...


Doh! :igor:

You're right. Thanks.


Glad I could help. :)