Take this script:
Source: "{tmp}\HelpDocSetup.exe"; \
DestDir: "{app}"; \
Flags: external deleteafterinstall; \
Tasks: downloadhelp; \
Check: DwinsHs_Check( ExpandConstant('{tmp}\HelpDocSetup.exe'), '{#HelpDocSetupURL}', 'My_Setup', 'Get', 0, 0 )
See the 0, 0
at the end of the line?
According to the documentation for DwinsHs_Check
it states:
FileSize : LongInt
Together with the
FileSizeHigh
parameter specifies the file size in bytes. It will be used to calculate the download progress and remaining time. This avoids delays before the download begins because the script doesn't have to fetch the file size from the server.This parameter specifies the low 31 bits of the file size, and the
FileSizeHigh
parameter specifies the high 31 bits of the file size. Note, not 32 bits.Note, the file size will be fetched from the server if the parameter is set to
FILESIZE_QUERY_SERVER (0)
,FILESIZE_UNKNOWN (-1)
, orFILESIZE_KEEP_FORMER (-2)
. In this case, the value ofFileSize
parameter will be ignored.Note, only digital value can be used in this parameter, the constant identifier cannot be used.
FileSizeHigh: LongInt
Together with the
FileSize
parameter specifies the file size in bytes. It will be used to calculate the download progress and remaining time. This avoids delays before the download begins because the script doesn't have to fetch the file size from the server.This parameter specifies the high 31 bits of the file size, and the
FileSize
parameter specifies the low 31 bits of the file size.Note, the value of this parameter will be ignored if the FileSize parameter is set to
FILESIZE_QUERY_SERVER (0)
,FILESIZE_UNKNOWN (-1)
, orFILESIZE_KEEP_FORMER (-2)
.Note, only digital value can be used in this parameter, the constant identifier cannot be used.
This particular setup file is also on my computer. Relative to the main ISS file the path would be:
..\HelpNDoc\CHM\Output\PublicTalksHelpDocumentationSetup.exe
Can we use ISPP to extract the file size and split it as the two parameters required for DwinsHs_Check
?
You can use FileSize
preprocessor function to retrieve the file size. But it's limited to 2GB = 31 bits. What corresponds to the FileSize
argument of DwinsHs_Check
:
#define ExeSize FileSize("..\HelpNDoc\CHM\Output\PublicTalksHelpDocumentationSetup.exe")
Check: DwinsHs_Check( ExpandConstant('{tmp}\HelpDocSetup.exe'), '{#HelpDocSetupURL}', \
'My_Setup', 'Get', {#ExeSize}, 0)
If the file could theoretically be over 2GB, you would have to use other means to retrieve the file size – e.g. by calling PowerShell code with Exec
preprocessor function. And you should split the size into the two parts in the PowerShell (or other) code straight away, as the Inno Setup preprocessor cannot work with 64-bit numbers anyway.
For examples of calling PowerShell code and returning its results, see: