Skip to content
⌘ NSIS Forum Archive

StrCmp syntax please?

6 posts

gte806e#

StrCmp syntax please?

I've read over the help for this and still i'm a bit unclear.

I want to parse the $INSTADIR and return it without the leading drive letter and semicolon.

Now the idea was to use StrCpy to remove the c:\

so I have

StrCpy $objPath $INSTDIR 2

delete "$APPDATA\Macromedia\Flash Player\localhost\$objPath"

Which my hope i'd be deleting

C:\Documents and Settings\jedwards\Application Data\Macromedia\Flash Player\localhost\Program Files\appname\

But I keep getting errors on StrCpy. Please help!
Joel#
mmm, something like this:

SetCompressor lzma
XPStyle on

Name "Lobo Lunar"
OutFile "Test.exe"
BrandingText "Lobo Lunar"
InstallDir "$EXEDIR"
ShowInstDetails show

Section "-default"
DetailPrint $EXEDIR
Strlen $0 $EXEDIR
IntOp $0 $0 - 2
StrCpy $R0 $EXEDIR $0 3
DetailPrint $R0
SectionEnd
gte806e#
Figured it out, the var name was the problem. But why the heck cant I use a var name with more than one character??

$1 worked
$objPath didnt

WHY!?

🙂
Afrow UK#
You need to define custom variables before compile, so insert Lobo Lunar's code at the top of your script (outside any Section's & Function's)

-Stu