I'm trying to use the function here:
http://nsis.sourceforge.net/Get_all_entries_in_section_of_INI_file
Along with nsisdl to loop through an ini file with a url per line. Unfortunately once I nsisdl gets called, getsection breaks and doesn't call my function after the initial download. Simplified code:
Calling line:
${GetSection} $R2\ver.ini "patches" "GetPatch"
And my function:
Function GetPatch
DetailPrint "Downloading patch..."
NSISdl::download http://???/patches/$9 "$R2\$9"
Push $0
FunctionEnd
Example ini file:
[patches]
1.zip
2.zip
3.zip
Unfortunately I don't really understand how stack work so I'm not clear on how to fix this. If i comment out nsisdl it works fine and getpatch gets called for each of the 3 zip files, but with it in there it only gets called for the first one.
Can anyone lend a hand?
Getsection + Nsisdl
5 posts
You forgot to Pop the result of NSISdl. Add Pop $1 or some other variable right after NSISdl::download. You should also compare $1 to "success" to make sure the download succeeded.
No luck, I added a pop after the nsisdl and the variable gets populated with "success", but it still doesn't continue downloading the patches 🙁
Edit: Never mind, adding a second pop seemed to solve the problem, thanks!
Edit: Never mind, adding a second pop seemed to solve the problem, thanks!
i know this post is old.. but it relates to GetSection im having problems with...
1. i have !include GetSection.nsh
2.
i've tried different locations,, variables, files, sections, etc.
i also tried copying the script bypassing the !include..
is it me or is the script faulty?
1. i have !include GetSection.nsh
2.
${GetSection} "$EXEDIR\${NAME}Settings.ini" "${NAME}Settings" "GetRegistrySection"3. and in the callback:
Function GetRegistrySection
MessageBox MB_OK "$9"
Push $0
FunctionEnd nothing.. no response.. i've tried different locations,, variables, files, sections, etc.
i also tried copying the script bypassing the !include..
is it me or is the script faulty?
Found Reason
it's not unicode compatible
i ended up using FileOpen, FileRead, etc... in a loop:
Originally Posted by PoRtAbLe_StEaLtH View Posti know this post is old.. but it relates to GetSection im having problems with...
1. i have !include GetSection.nsh
2.
3. and in the callback:
nothing.. no response..Function GetRegistrySection MessageBox MB_OK "$9" Push $0 FunctionEnd
i've tried different locations,, variables, files, sections, etc.
i also tried copying the script bypassing the !include..
is it me or is the script faulty?
it's not unicode compatible
System::Call "kernel32::GetPrivateProfileSectionA
System::Call 'kernel32::lstrlenA(t) i(i r4) .r6' i looked these up and found the Unicode variable by switching A to W, but the script has to be rewritten.. instead of reading line by line in the INI section.. it reads char by char on each line.i ended up using FileOpen, FileRead, etc... in a loop:
ClearErrors
FileOpen $0 "$SETTINGSDIRECTORY\${NAME}Settings.ini" r
StrCpy $R0 "0" # initialize index
${Do}
ClearErrors
FileRead $0 $2
IfErrors endINISec
StrCpy $3 $2 4
${If} $3 == HKLM
${Trim} $2 ; trim carriage return
StrCpy $4 $2 -2 ; remove last 2 char
;StrCpy $1 $4 "" 5 ; remove first 5 char
${Registry::RestoreBackupKey} "$4"
;MessageBox MB_OK `DEBUG: $4`
;MessageBox MB_OK `DEBUG: $1`
${ElseIf} $3 == HKCU
${Trim} $2 ; trim carriage return
StrCpy $4 $2 -2 ; remove last 2 char
;StrCpy $1 $4 "" 5 ; remove first 5 char
${Registry::RestoreBackupKey} "$4"
;MessageBox MB_OK `DEBUG: $4`
;MessageBox MB_OK `DEBUG: $1`
${EndIf}
IntOp $R0 $R0 + 1 ; $R0 must be incremented to move to next key
${LoopWhile} $2 != ""
endINISec:
FileClose $0