- NSIS Discussion
- InetLoad, GetSectionNames Problem
Archive: InetLoad, GetSectionNames Problem
Chieftec
31st October 2006 02:58 UTC
InetLoad, GetSectionNames Problem
Hi,
I have the following Problem:
I am using inetLoad to get stuff from the web. For this I am using the GetSectionNames Function to loop over the INI-File:
Function .onInit
#Loading updatefile
InetLoad::load "http://example.com/update.ini" "$TEMP\update.ini"
FunctionEnd
Function GetUpdates
ReadINIStr $Path "$TEMP\update.ini" "$9" "path"
InetLoad::load "http://example.com/$Path" "$DESKTOP\$Path"
Push $0
FunctionEnd
Section GetSections
${GetSectionNames} "$DESKTOP\update.ini" "GetUpdates"
SectionEnd
When I use a simple MessageBox instead of the InetLoad:load it shows me all the sections in the INI-File... So why doesn't it work with InetLoad?
Thank you in anticipation!
deguix
31st October 2006 03:30 UTC
The most suitable answer to the event is that you didn't put the "/NOUNLOAD" optional parameter before the first parameter of all the "InetLoad::load" calls. Without it, the plug-in always unloads after the call is completed, except in some plug-ins. I have no information if this is true for this plug-in, specifically, so please check this information.
Chieftec
31st October 2006 13:26 UTC
Thx deguix
I added the "/NOUNLOAD"-Parameter but it still doesn't work. Any other ideas how I can manage this?
Animaether
31st October 2006 13:36 UTC
make sure the ini files are downloaded correctly, first. The GetSectionNames call should be fine -if- the ini files are present and correct.
Chieftec
31st October 2006 14:31 UTC
The INI-File is downloaded correctly...
Animaether
31st October 2006 15:11 UTC
Try just a ReadINIStr in your GetSections section.. see if that reads okay.. e.g.
ReadIniStr $0 "$DESKTOP\update.ini" "GetUpdates" "somekey"
where somekey should be an existing key name -_-
Takhir
31st October 2006 15:55 UTC
InetLoad puts download result as string to stack. There are 2 reasons to pop this string in .onInit and later, first is to check download status ("OK"), the second - next InetLoad call tries to get more url/file pairs from stack and fails this case. You can use /end at the end of InetLoad command line to stop stack reading.
It was kichik who asked about few files download in the single plug-in call ;)
Chieftec
31st October 2006 17:41 UTC
@Animaether: Yes, it works.
@Takhir: Can you give me an example, please?
Takhir
31st October 2006 18:35 UTC
Example.nsi included to InetLoad package.
InetLoad::load "http://example.com/update.ini" "$TEMP\update.ini" /END
Pop $0
StrCmp $0 "OK" +2
MessageBox MB_OK "Download Failed: $0"
...
Function GetUpdates
ReadINIStr $Path "$TEMP\update.ini" "$9" "path"
InetLoad::load "http://example.com/$Path" "$DESKTOP\$Path"
Pop $0
FunctionEnd