I managed to solve my previous issue, here's the code I came up with to get a size of file at compile time:
Usage:!macro CTFileSize _FILE _RESULT
!echo 'CTFileSize: "${_FILE}"'
!verbose push
!verbose 3
!tempfile __TEMP_BAT_FILE
!delfile "${__TEMP_BAT_FILE}"
!tempfile __TEMP_NSH_FILE
!delfile "${__TEMP_NSH_FILE}"
!system 'cmd /C ECHO @ECHO Push %~z1 > "${__TEMP_BAT_FILE}.bat"'
!system '"${__TEMP_BAT_FILE}.bat" "${_FILE}" > "${__TEMP_NSH_FILE}.nsh"'
!include "${__TEMP_NSH_FILE}.nsh"
!delfile "${__TEMP_BAT_FILE}.bat"
!undef __TEMP_BAT_FILE
!delfile "${__TEMP_NSH_FILE}.nsh"
!undef __TEMP_NSH_FILE
Pop ${_RESULT}
!verbose pop
!macroend
Perhaps somebody else will find it useful.!insertmacro CTFileSize "C:\Windows\notepad.exe" $R0
MessageBox MB_OK "Size of notepad: $R0 bytes"
P.S. I use this code to calculate the size of a section for several install modes, and change it at runtime, using the SectionSetSize function.
The docs say:
"The Value for Size must be entered in KiloByte and supports only whole numbers."
Only whole KBs? Why the heck is that? o_0