Skip to content
⌘ NSIS Forum Archive

nsArray issue comparing registers from "get" command

3 posts

techline2012#

nsArray issue comparing registers from "get" command

Hey everyone,

Not really too new to NSIS but definitely not an advanced user quite yet. I'm having an issue and I'm not sure if its with NSIS itself or the nsArray plugin. I'll attach my code here.


Section rkill
SectionIn 1 2

;Iterate through the array, and set $1 = current key and $2 = current value
${ForEachIn} array $1 $2

;Set $3 = to the string I want to compare $2 (current value) to.
StrCpy $3 rkill

;Compare $2 (current value) to $3 (my string), if not equal jump 3 instructions
StrCmp $2 $3 0 +3

;If equal, set array at $1 (current key) = to value of "rkill=1" and display "Match"
nsArray::Set array /key=$1 rkill=1
detailprint "Match"

;Continue looking through the array
${Next}
SectionEnd
I'll explain it here. I have a section where the user can choose if they want to enable or disable this specific program. I have an array, with one entry in the array having a key of "rkill" and a value of "rkill". However, for some reason I am unable to compare the register values of $2 and $3. At no point do I get an output of "match", and the value in the array is never being changed to "rkill=1. Where can this be having an issue?

Thanks for the help
Anders#
What does DetailPrint "|$2|$3|" tell you?

You should really use ${If} from LogicLib.nsh or at least a label, StrCmp with a relative offset is error prone... (I don't even think it is documented how many instructions a plugin call is)
techline2012#
DetailPrint "|$2|$3|" outputs "|rkill|rkill|". I was using ${If} to compare the strings before, but again it wasn't working either. I moved to strcmp because it seemed like a different option.