I'm a newbie, a little bit confused with the usage of variables with the Name Installer attribute.
Below is the code. Also a bit confused if the usage of variable with the Math plugin is the right and recommended way.
Please let me know what I might be doing wrong. Thank you.
-Jramak
----------------------------------------------------------
Var floatWeight
!define WEIGHT_INCREMENT 3
; Item weight read from file.py is 2
!searchparse /file "C:\file.py" `__text__ = \
int("$Itemweight:`ITEM_WEIGHT `$"[11:-2])`
Section "Pre-processing Operations" SEC01
Math::Script "$floatWeight = ${WEIGHT_INCREMENT} + ${ITEM_WEIGHT} / 100.00"
SectionEnd
;Name to be assigned "Weight 3.02"
Name "Weight ${floatWeight}"
----------------------------------------------------------
Use of Name Installer attribute with a variable
3 posts
OK, so I figured this out. Posting the answer so it can help others.
In general, it is a bit confusing to as whether to use '{}' for variables or omit them or use '()'.
------------------------------------------------------------
Var floatWeight
!define WEIGHT_INCREMENT 3
; Item weight read from file.py is 2
!searchparse /file "C:\file.py" `__text__ = \
int("$Itemweight:`ITEM_WEIGHT `$"[11:-2])`
Function .onInit
Math::Script "r1 = ${WEIGHT_INCREMENT} + ${ITEM_WEIGHT} / 100.00"
StrCpy $floatWeight $1
FunctionEnd
;Name to be assigned "Weight 3.02"
Name "Weight $floatWeight"
------------------------------------------------------------
In general, it is a bit confusing to as whether to use '{}' for variables or omit them or use '()'.
------------------------------------------------------------
Var floatWeight
!define WEIGHT_INCREMENT 3
; Item weight read from file.py is 2
!searchparse /file "C:\file.py" `__text__ = \
int("$Itemweight:`ITEM_WEIGHT `$"[11:-2])`
Function .onInit
Math::Script "r1 = ${WEIGHT_INCREMENT} + ${ITEM_WEIGHT} / 100.00"
StrCpy $floatWeight $1
FunctionEnd
;Name to be assigned "Weight 3.02"
Name "Weight $floatWeight"
------------------------------------------------------------
How confusing can it be?
${define}
$(langstring)
$var
(defines are set at compile time, the others at runtime)
${define}
$(langstring)
$var
(defines are set at compile time, the others at runtime)