|
|
|
|
#1 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
NSISdl macros
I was using NSISdl to download multiple files throughout my installer, so I figured that it would be easier to make a macro (with error/success/cancel messages and all) without having to repeat the same code so many times (in different functions/sections).
I've attached it below, any suggestions, comments, or changes would be much appreciated. I'm not sure if there are any similar macros to my ones, but it would be cool if it was included with NSIS ![]() -Stu |
|
|
|
|
|
#2 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
Looks nice. Maybe think of something better instead of run-time URL splitting.
|
|
|
|
|
|
#3 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
It fitted what I needed, but what woud you mean by that?
-Stu |
|
|
|
|
|
#4 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
You are splitting parameters on run-time, that adds size to the installer.
|
|
|
|
|
|
#5 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
How would I be able to go about this?
-Stu |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Ok, so I should use !system, and split the string on compile time, rather than on runtime. Will this work?
-Stu |
|
|
|
|
|
#7 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
That's indeed better.
|
|
|
|
|
|
#8 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Ok, I have no idea how to use !system, or split a string on compile time (using NSIS script)
Help would be much appreciated. -Stu |
|
|
|
|
|
#9 |
|
Major Dude
|
Is difficult to explain. [EDITED]Have to be much changes in your macros, is too much confuse. I don't make a better function now because I don't have a "my computer" (using only public computers).
Is better look the new version of function "Detect System Language" that I will launch tomorrow, I will use macros to don't use any space when you don't need the function and some other useful great features... Last edited by deguix; 14th August 2003 at 23:39. |
|
|
|
|
|
#10 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
The simplest way would probably be letting the user push the URLs instead of supplying them as an argument to the macro. Use something like:
START_URLS Push url Push url2 ... END_URLS START_URLS should push a certain string that will specify the end of the URLs list. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#11 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
That's a great idea Kichik!
Very simple solution that is much better than current. -Stu |
|
|
|
|
|
#12 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
I've got this working, but have had problems.
I'm popping NSISdl's return value from the stack, which is coinciding with the urls on the stack. Using Pop in some places made the Invalid opcode error appear, so I replaced some with Exch (NSISdl return value pop and URLS pop) It seems to work now, but it would be nice if somone could check the script for me: Last edited by Afrow UK; 15th August 2003 at 12:34. |
|
|
|
|
|
#13 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Invalid opcode error is caused by Exch, not Pop. It happens if Exch is called and the stack is empty/not large enough. I don't think there should be any problem with NSISdl pushing stuff on the stack as long as you pop them all.
You can also use the pushed items for NSISdl instead of popping and pushing them back. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#14 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Well, I was having the Invalid opcode when Popping NSISdl's return value before Pushing the variable (or somthing) onto the stack first.
I knew it was the Pop because I placed messagebox before and after it; only the one before it would appear and then the error. I think that it looks ok and it must be working ok - it definately gets hold of "urls_start" on the stack after trying all urls. -Stu |
|
|
|
|
|
#15 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Wait, placing two fake urls in screws it up (doesn't get to "urls_start")
I'll find out why... -Stu |
|
|
|
|
|
#16 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Ok you are right, it's actually the Exch at the end of the script causing it.
Why is this, and how can I fix it? -Stu |
|
|
|
|
|
#17 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
I've ended up using this to fix it:
Push $R0 Exch $R0 Everything works great now. -Stu |
|
|
|
|
|
#18 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
It happens if Exch is called and the stack is empty/not large enough. For example, calling Exch when the stack is empty will trigger this error message. This will too:
Push a Push b Exch 2 NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#19 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Here is latest script:
[edit]Removed SplitString function[/edit] -Stu Last edited by Afrow UK; 15th August 2003 at 13:42. |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|