newbie here
i'm currently trying to figure out how to assign a downloaded file's path to MUI_PAGE_LICENSE macro like this:
!insertmacro MUI_PAGE_LICENSE blah_txt_location
i know that i can do inetc::get /SILENT "online file location" "install location" /end
to get the file downloaded - but my problem is that !insertmacro
is ran during compile time and downloading the file is done during run time (i think im correct with that - please tell me if not)
So how can i go about doing this?
Edit: Turns out anders code did work however adding OutFile "App.exe"
will crash it
You can't assign it directly, you have to load it dynamically:
!include MUI2.nsh
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DelayLoadLicenseFile
!tempfile dummylicense
!appendfile "${dummylicense}" "$\n"
!insertmacro MUI_PAGE_LICENSE "${dummylicense}"
!delfile "${dummylicense}"
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
Function DelayLoadLicenseFile
SendMessage $mui.Licensepage.LicenseText ${EM_LIMITTEXT} -1 ""
FileOpen $1 "$PluginsDir\license.txt" R
${If} $1 P<> 0
FileSeek $1 0 END $2
FileSeek $1 0 SET
System::Call '*(&m$2)p.r3'
System::Call 'KERNEL32::ReadFile(p$1,p$3,i$2,*i,p0)'
System::Call 'USER32::SendMessageA(p$mui.Licensepage.LicenseText,i${WM_SETTEXT},p0,p$3)'
System::Free $3
FileClose $1
#${Else}
# MessageBox mb_iconStop "blah blah license!"
# Quit
${EndIf}
FunctionEnd
Function .onInit
InitPluginsDir
inetc::get /SILENT "http://example.com/license.txt" "$PluginsDir\license.txt" /end
Pop $0
Messagebox mb_ok Debug:$0
FunctionEnd
You probably don't want to leave the default license empty though, the download might fail if the user is not online or the server is down. If you want to load a RTF file you might have to stream it in...