Old 15th January 2018, 14:10   #1
Lord Cris
Junior Member
 
Join Date: Dec 2017
Posts: 9
Fileread problem

For now i have an explicit problem.

In my main script i call this function at descriptionInit

code:

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:

code:

!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 is offline   Reply With Quote
Old 15th January 2018, 17:24   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,768
$${addonVar} is not correct.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 16th January 2018, 06:10   #3
Lord Cris
Junior Member
 
Join Date: Dec 2017
Posts: 9
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 is offline   Reply With Quote
Old 16th January 2018, 11:50   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,768
The second FileRead parameter must be a variable, otherwise you get that compiler error.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 16th January 2018, 12:04   #5
Lord Cris
Junior Member
 
Join Date: Dec 2017
Posts: 9
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.
Lord Cris is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump