Archive: multi file inetc download, conditional checkbox


multi file inetc download, conditional checkbox
hey can anybody answer this?
how can i make inetc nsis plugin download multiple files at once using only one string variable for all the url pairs? like so

strcpy $urlpairs "\"http://w.w.w.txt\""
strcpy $urlpairs "$urlpairs \"C:\w.txt\""
strcpy $urlpairs "$urlpairs \"http://w.w.a.txt\""
strcpy $urlpairs "$urlpairs \"C:\a.txt\""
strcpy $urlpairs "$urlpairs \"http://w.w.b.txt\""
strcpy $urlpairs "$urlpairs \"C:\b.txt\""
inetc:get $urlpairs

and how do i make conditional section checkboxes
like
[] FilipinoDictionary
|_[] FilipinoDictionaryWebsite
|_[] SysAdDic
|_[] OfflineFilipinoDictionaryGU
|_[] mysqldb
where
when one clicks FilipinoDictionary, the other three are clicked/checked.
when one clicks/checks OfflineFilipinoDictionaryGU, it also checks mysqldb
when one clicks/checks SysAdDic, it also checks OfflineFilipinoDictionaryGU and mysqldb
when one clicks/checks FilipinoDictionaryWebsite, it also checks SysAdDic, OfflineFilipinoDictionaryGU and mysqldb


this is so because
FilipinoDictionaryWebsite needs files from SysAdDic, OfflineFilipinoDictionaryGU and mysqldb to work
SysAdDic needs files from , OfflineFilipinoDictionaryGU and mysqldb to work
OfflineFilipinoDictionaryGU needs files from mysqldb to work

please, if anybody can answer them i'll gladly appreciate it because this is for my thesis.

thanks in advance.


how can i make inetc nsis plugin download multiple files at once using only one string variable for all the url pairs?
Build a macro, e.g.
!macro INETC_DNLD FILE1 LOCATION1 FILE2 LOCATION2
inetc::get "${FILE1}" "${LOCATION1}" "${FILE2}" "${LOCATION2}"
!macroend

section ""
!insertmacro INETC_DNLD "http://dl.zvuki*****6306/mp3/12.mp3" "$EXEDIR\12.mp3" \
"ftp://dl.zvuki*****6306/mp3/11.mp3" "$EXEDIR\11.mp3"
sectionend



and how do i make conditional section checkboxes
See Sections in NSIS manual.

With NSIS you don't need string variables at all ;)
How it work: Installer pushes plug-in parameters (from command line) to stack and plug-in (when launched) pops them back. So following code samples are absolutely have no difference:

Push /end
Push "$EXEDIR\22.mp3"
Push http://dl.zvuki*****6306/mp3/22.mp3
Push "$EXEDIR\12.mp3"
Push http://dl.zvuki*****6306/mp3/12.mp3
inetc::get
and
inetc::get http://dl.zvuki*****6306/mp3/12.mp3 "$EXEDIR\12.mp3" \
http://dl.zvuki*****6306/mp3/22.mp3 "$EXEDIR\22.mp3" /end
First variant is even better because of string length limit (1k in common build). But be carefull - stack might be used by other parts of your code, so number of other pushes must be equal to number of pops, otherwise urls will be messed with other vars ;) One of such vars is plug-in' exit code, do not forget Pop (like in Example.nsi) after plug-in line.

i got the last one on sections
i got the last one on sections
here are the conditional sections
(for search engines to use in searching for answers to problems similar to this)


FilipinoDictioanry.nsi (mingw.nsi derivative) code portions:
<code>#
Function .onInit
;-----------------------------------------------------------------------------------------------------------------------
SectionGetFlags ${SecMySQLDatabase} $secmdb
SectionGetFlags ${SecOfflineFilipinoDictionaryGU} $secofgu
SectionGetFlags ${SecSysAdDic} $secsa
SectionGetFlags ${SecFilipinoDictionaryWebsite} $secfdw
SectionSetFlags ${SecFilipinoDictionaryInstaller} ${SF_RO}
; prevent multiple instances of installer
StrCpy $sized "false"

System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .r0 ?e"
Pop $0
StrCmp $0 0 launch
StrLen $0 "$(^Name)"
IntOp $0 $0 + 1

loop:
FindWindow $1 '#32770' '' 0 $1
IntCmp $1 0 +4
System::Call "user32::GetWindowText(i r1, t .r2, i r0) i."
StrCmp $2 "$(^Name)" 0 loop
System::Call "user32::SetForegroundWindow(i r1) i."
System::Call "user32::ShowWindow(i r1,i 9) i."
Abort
launch:

call GetInitialMirrors

StrCpy $R0 $WINDIR 1
StrCpy $INSTDIR $R0:\

;!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "Dialogs\PickMirror.ini" "PickMirror.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "Program Files\FilipinoDictionary\FilipinoDictionaryInstaller\Dialogs\ChoosePackage.ini" "ChoosePackage.ini"

StrCpy $Updating 0

StrCpy $ChooseMessage "Choose the FilipinoDictionary components you would like to install. 'Minimal' install assumes the other components are already installed in their respective directories and installs 'FilipinoDictionary base tools' and 'MySQL FilipinoDictionary Database'. 'CD run with update' install installs only 'MySQL FilipinoDictionary Database' and shortcuts to run the 'FilipinoDictionary base tools' programs from the Compact Disc using the installed 'MySQL FilipinoDictionary Database' located at the hard disk. 'Full' installs all components. 'Custom' lets you install the components you want to install assuming the unchecked ones are already installed (don't check anything if you only want to install the shortcuts to 'FilipinoDictionary base tools' only, maybe for easy navigation of programs from the 'FilipinoDictionary base tools'.)"

ReadRegStr $1 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
StrCmp $1 "" first_install

StrCpy $INSTDIR $1

ifFileExists $INSTDIR\installed.ini +1 first_install

StrCpy $Updating 1

StrCpy $ChooseMessage "Choose the FilipinoDictionary components you would like to update."

ReadINIStr $Package $INSTDIR\installed.ini "settings" "installtype"

InstTypeSetText 0 ""
InstTypeSetText 1 ""
InstTypeSetText 2 ""

goto installing

first_install:
; SectionSetText ${SecSysAdDic} ""
; SectionSetText ${SecFilipinoDictionaryWebsite} ""
; SectionSetText ${SecOfflineFilipinoDictionaryGU} ""
; SectionSetText ${SecMySQLDatabase} ""

installing:

InitPluginsDir
GetTempFileName $mirrorINI $PLUGINSDIR
File /oname=$mirrorINI "Program Files\FilipinoDictionary\FilipinoDictionaryInstaller\Dialogs\ShowMirror.ini"
;MessageBox MB_YESNO|MB_ICONINFORMATION|MB_DEFBUTTON1 "$mirrorINI"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "Program Files\FilipinoDictionary\FilipinoDictionaryInstaller\Dialogs\ShowMirror.ini" "ShowMirror.ini"
;StrCpy $mirrorINI $umuiini

StrCpy $mirrorINI "$PLUGINSDIR\ShowMirror.ini"

;MessageBox MB_YESNO|MB_ICONINFORMATION|MB_DEFBUTTON1 "$mirrorINI"
FunctionEnd
/*...omitted irrelevant code*/
SectionGroup /e "!FilipinoDictionary base tools" SecBase
Section FilipinoDictionaryWebsite SecFilipinoDictionaryWebsite
SectionIn 1 2 6
SectionEnd

Section SysAdDic SecSysAdDic
SectionIn 1 2 5 6
SectionEnd
Section OfflineFilipinoDictionaryGU SecOfflineFilipinoDictionaryGU
SectionIn 1 2 4 5 6
SectionEnd
Section mysqldatabase SecMySQLDatabase
SectionIn 1 2 3 4 5 6
SectionEnd
Section "FilipinoDictionaryInstaller" SecFilipinoDictionaryInstaller
SectionIn 1 2 4 5 6
StrCpy $tarball "Program Files\FilipinoDictionary\FilipinoDictionaryInstaller"
push $tarball
call DownloadFromMirror

CreateDirectory "$INSTDIR\$tarball"

${GetSize} "$EXEDIR\$tarball" "/S=0B" $0 $1 $2
IntOp $R3 0 + 0
IntOp $R3 0 + $0
${RecFindOpen} "$EXEDIR\$tarball" $R0 $R1
DetailPrint "Dir: $R0: size: $R3"
${RecFindFirst}
DetailPrint "File: $EXEDIR\$tarball$R0\$R1 to $INSTDIR\$tarball$R0\$R1"
CreateDirectory "$INSTDIR\$tarball$R0\$R1"
RMDir "$INSTDIR\$tarball$R0\$R1"
CopyFiles "$EXEDIR\$tarball$R0\$R1" "$INSTDIR\$tarball$R0\$R1"
SetFileAttributes "$INSTDIR\$tarball$R0\$R1" FILE_ATTRIBUTE_NORMAL
CopyFiles $EXEDIR\$R1 "$INSTDIR\Program Files\FilipinoDictionary\FilipinoDictionaryInstaller\$R1"
CopyFiles "$EXEDIR\${PRODUCT_NAME}.nsi" "$INSTDIR\Program Files\FilipinoDictionary\FilipinoDictionaryInstaller\${PRODUCT_NAME}.nsi"
CopyFiles "$EXEDIR\OfflineFilipinoDictionaryGU.nsi" "$INSTDIR\Program Files\FilipinoDictionary\FilipinoDictionaryInstaller\OfflineFilipinoDictionaryGU.nsi"
CopyFiles "$EXEDIR\OfflineFilipinoDictionaryGU-${PRODUCT_VERSION}.exe" "$INSTDIR\Program Files\FilipinoDictionary\FilipinoDictionaryInstaller\OfflineFilipinoDictionaryGU-${PRODUCT_VERSION}.exe"
;StrCmp $R1 "a_file.txt" Found
${RecFindNext}
;Found:
${RecFindClose}

SectionEnd
SectionGroupEnd
var secmdb
var secofgu
var secsa
var secfdw
Function .onSelChange
IntOp $1 0 + 0
SectionGetFlags ${SecMySQLDatabase} $4
SectionGetFlags ${SecOfflineFilipinoDictionaryGU} $0
SectionGetFlags ${SecSysAdDic} $2
SectionGetFlags ${SecFilipinoDictionaryWebsite} $3
;MessageBox MB_YESNO|MB_ICONINFORMATION|MB_DEFBUTTON1 $4$0$2$3
;MessageBox MB_YESNO|MB_ICONINFORMATION|MB_DEFBUTTON1 m$secmdbo$secofgus$secsaf$secfdw
IntCmp $secmdb $4 +1 mdb mdb
IntCmp $secofgu $0 +1 ofgu ofgu
IntCmp $secsa $2 +1 sa sa
IntCmp $secfdw $3 end fdw fdw
;SectionSetFlags ${SecSysAdDic} $1
mdb:
IntCmp $4 0 +1 end end
SectionSetFlags ${SecOfflineFilipinoDictionaryGU} $1
SectionSetFlags ${SecSysAdDic} $1
SectionSetFlags ${SecFilipinoDictionaryWebsite} $1
goto end
ofgu:
IntCmp $0 ${SF_SELECTED} +1 +3 +3
SectionSetFlags ${SecMySQLDatabase} ${SF_SELECTED}
goto end
SectionSetFlags ${SecSysAdDic} $1
SectionSetFlags ${SecFilipinoDictionaryWebsite} $1
goto end
sa:
IntCmp $2 $1 +1 +3 +3
SectionSetFlags ${SecFilipinoDictionaryWebsite} $1
goto end
SectionSetFlags ${SecMySQLDatabase} ${SF_SELECTED}
SectionSetFlags ${SecOfflineFilipinoDictionaryGU} ${SF_SELECTED}
goto end
fdw:
IntCmp $3 ${SF_SELECTED} +1 +4 +4
SectionSetFlags ${SecMySQLDatabase} ${SF_SELECTED}
SectionSetFlags ${SecOfflineFilipinoDictionaryGU} ${SF_SELECTED}
SectionSetFlags ${SecSysAdDic} ${SF_SELECTED}

/*
StrCmp "$3$2$0$4" "0010" +1 +2
IntCmp $2 ${SF_SELECTED} +1 +3 +3
SectionSetFlags ${SecOfflineFilipinoDictionaryGU} ${SF_SELECTED}
SectionSetFlags ${SecMySQLDatabase} ${SF_SELECTED}
IntCmp $2 $1 +1 +2 +2
SectionSetFlags ${SecFilipinoDictionaryWebsite} $1
IntCmp $3 ${SF_SELECTED} +1 +4 +4
SectionSetFlags ${SecMySQLDatabase} ${SF_SELECTED}
SectionSetFlags ${SecOfflineFilipinoDictionaryGU} ${SF_SELECTED}
SectionSetFlags ${SecSysAdDic} ${SF_SELECTED}
IntCmp $2 ${SF_SELECTED} +1 +3 +3
SectionSetFlags ${SecMySQLDatabase} ${SF_SELECTED}
SectionSetFlags ${SecOfflineFilipinoDictionaryGU} ${SF_SELECTED}
;SectionSetFlags ${SecSysAdDic} $1
SectionSetFlags ${SecFilipinoDictionaryWebsite} $1
IntCmp $0 ${SF_SELECTED} +1 +2 +2
SectionSetFlags ${SecMySQLDatabase} ${SF_SELECTED}
;SectionSetFlags ${SecOfflineFilipinoDictionaryGU} $1
SectionSetFlags ${SecSysAdDic} $1
SectionSetFlags ${SecFilipinoDictionaryWebsite} $1
IntCmp $4 $1 +1 end end
;SectionSetFlags ${SecMySQLDatabase} $1
SectionSetFlags ${SecOfflineFilipinoDictionaryGU} $1
SectionSetFlags ${SecSysAdDic} $1
SectionSetFlags ${SecFilipinoDictionaryWebsite} $1
*/

;SectionSetFlags ${SecOfflineFilipinoDictionaryGU} $1


; SectionSetFlags ${SecFilipinoDictionaryWebsite} ${SF_SELECTED}
end:
SectionGetFlags ${SecMySQLDatabase} $secmdb
SectionGetFlags ${SecOfflineFilipinoDictionaryGU} $secofgu
SectionGetFlags ${SecSysAdDic} $secsa
SectionGetFlags ${SecFilipinoDictionaryWebsite} $secfdw
FunctionEnd

Section "ServCD" SecServCD
SectionIn 2
SectionEnd
Section "Java JRE 1.5" SecJRE
SectionIn 2
SectionEnd
Section "Tiny C Compiler" SecTCC
SectionIn 2
SectionEnd
Section "Java DynDNS client" SecNIPDUC
SectionIn 2
SectionEnd
Section "Mozilla Firefox 2" SecIE6
SectionIn 2
SectionEnd
Section "VideoLAN VLC media player 0.8.5" SecWMP10
SectionIn 2
SectionEnd

var Updating
Section -installComponents
SetAutoClose false
SectionEnd
/* omitted irrelevant code*/
</code>