Skip to content
⌘ NSIS Forum Archive

Fileread problem

5 posts

Lord Cris#

Fileread problem

For now i have an explicit problem.

In my main script i call this function at descriptionInit


Function ReadAllDesc
Var /global j
${foreach} $j 0 $secCount + 1
SectionGetText $h $4
${StrContains} $5 "++" $4
${ifnot} $5 == ""
StrCpy $5 $4 "" 2
${else}
StrCpy $5 $4
${endif}
!insertmacro DESC_READ $4 $lang $5
${next}
FunctionEnd
the macro has followed code in it:


!macro DESC_READ addonText lang addonVar
FileOpen $6 "$TEMP\addonInstallerPreFolder\5.1\${addonText}_${lang}.txt" r
FileRead $6 $${addonVar}
FileClose $6
!macroend
my problem is now, that when i insert instat of $4 and $5 the explicit Names i can compile my script but when i want to use $5/$4 i got an error in my FileRead line

"Usage: FileRead $(user_var: handle input) $(user_var: text output) [maxlen]"

can anyone help me with that? Do i hae a logical problem or do it didnt work.

~ Cris
Lord Cris#
But when i swap for example

$4 with extension and $5 with ext then it works correctly. That is the thing what it is confusing me. My example is also guarantee to appear in my variable option in ReadAllDesc
Lord Cris#
Before i redesign my code in this Way i had $${addonVar} also and it worked well. in ${addonVar} is the name of an global Variable. And before i must do some changes(that the addon name has an other name as the Variable because of a leading ++ i had the same code but only 2 input parameter. And there it worked and when im got fixed names in the innput it worked too.