- NSIS Discussion
- Invalid Command: ${StrLoc}
Archive: Invalid Command: ${StrLoc}
Davidgn
13th April 2006 08:10 UTC
Invalid Command: ${StrLoc}
I am trying to manage a condition in my install. I want to check a string for occurencies of a certain substring, for example "XD1".
But when i call the StrLoc function the system either returns "Invalid Command ${StrLoc}" or says it is having problems resolving install function StrLoc. Then it gives me the tip that uninstall functions must begin with "un." and install functions must not.
I have included LogicLib.nsh and I am running version 2.07.
Please help me, I am stuck!
Red Wine
13th April 2006 08:19 UTC
!include "StrFunc.nsh"
StrFunc.nsh has to be inside Include directory, so you don't have to
specify a path.
You have to put this command before any command used in this header file.
Find it at: NSIS\Docs\StrFunc\StrFunc.txt :-)
Davidgn
13th April 2006 08:38 UTC
Hmm, strange that the page about StrLoc tells me that i need the LogicLic header file but not the StrFunc...
Davidgn
13th April 2006 09:02 UTC
Ok, I got one step further, but now I am stopped by this:
!insertmacro: FUNCTION_STRING_StrLoc
!insertmacro: macro "FUNCTION_STRING_StrLoc" requires 0 parameter(s), passed 4!
I make the call of the function like this:
${StrLoc} $0 $%MITRION_LICENSE% "xd1" ">"
and according to the nsis homepage it should work, but it doesn't.
Red Wine
13th April 2006 09:02 UTC
in case you use ${if} ${else} ${unless} etc statements you need LogicLib as well :-)
Davidgn
13th April 2006 09:10 UTC
I know, I use both now, but why does the StrLoc-function say that it needs zero arguments instead of four?
Red Wine
13th April 2006 09:56 UTC
in deed it says this. maybe a bug?
Davidgn
13th April 2006 09:58 UTC
Perhaps, it seems very strange to me so I have decided to solve the problem by using our perl-script and send a parameter to the nsis-script instead...
If anyone comes up with an idea, please post it.
Red Wine
13th April 2006 10:13 UTC
nope! we both did not read the doc deeply!
now it works!
!include "StrFunc.nsh"
${StrLoc}
section -
${StrLoc} $0 "This is just an example" "just" "<"
detailprint '$0'
sectionEnd
Afrow UK
13th April 2006 10:14 UTC
Did you put ${StrLoc} (with no parameters) after !include StrFunc.nsh? I don't think you did, because that causes the problem that you described.
It shows this in the readme and in the example script.
-Stu
Davidgn
13th April 2006 10:46 UTC
Is it supposed to be directly after? Because I make all my includes in the beginning of the file...
Red Wine
13th April 2006 12:10 UTC
it is supposed to be this:
3.1 How To Use Commands In Install Sections and Functions
---------------------------------------------------------
Every command used in install sections and functions have to be called
first before and out of any sections and functions, and without
parameters.
Example:
--------
${StrStr}
3.2 How To Use Commands In Uninstall Sections and Functions
-----------------------------------------------------------
Commands with Uninstall Sections and Functions support have "Un" before
the words inside curly brackets "{}".
Example:
--------
${UnStrStr}
A complete example with both Install and Uninstall Commands:
------------------------------------------------------------
!include "StrFunc.nsh"
${StrStr} # Supportable for Install Sections and Functions
${UnStrStr} # Supportable for Uninstall Sections and Functions
Section
${StrStr} $0 "OK! Now what?" "wh"
SectionEnd
Section Uninstall
${UnStrStr} $0 "OK! Now what?" "wh"
SectionEnd
Davidgn
13th April 2006 12:29 UTC
Ahhhhh
NOW I get it!
I guess I haven't got enough patience to find that in a readme.
Thanks a lot guys!