Old 8th August 2003, 15:10   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
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
Attached Files
File Type: nsh nsisdl.nsh (4.9 KB, 123 views)
Afrow UK is offline   Reply With Quote
Old 8th August 2003, 15:16   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
Looks nice. Maybe think of something better instead of run-time URL splitting.
Joost Verburg is offline   Reply With Quote
Old 8th August 2003, 15:20   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
It fitted what I needed, but what woud you mean by that?

-Stu
Afrow UK is offline   Reply With Quote
Old 8th August 2003, 15:49   #4
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
You are splitting parameters on run-time, that adds size to the installer.
Joost Verburg is offline   Reply With Quote
Old 8th August 2003, 16:31   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
How would I be able to go about this?

-Stu
Afrow UK is offline   Reply With Quote
Old 14th August 2003, 20:48   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Ok, so I should use !system, and split the string on compile time, rather than on runtime. Will this work?

-Stu
Afrow UK is offline   Reply With Quote
Old 14th August 2003, 21:22   #7
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
That's indeed better.
Joost Verburg is offline   Reply With Quote
Old 14th August 2003, 21:59   #8
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
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
Afrow UK is offline   Reply With Quote
Old 14th August 2003, 23:23   #9
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
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...

My Wiki Pages

Working now on:
New projects. (language: any)

Last edited by deguix; 14th August 2003 at 23:39.
deguix is offline   Reply With Quote
Old 15th August 2003, 10:02   #10
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
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
kichik is offline   Reply With Quote
Old 15th August 2003, 10:07   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
That's a great idea Kichik!
Very simple solution that is much better than current.

-Stu
Afrow UK is offline   Reply With Quote
Old 15th August 2003, 10:57   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
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.
Afrow UK is offline   Reply With Quote
Old 15th August 2003, 11:25   #13
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
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
kichik is offline   Reply With Quote
Old 15th August 2003, 11:32   #14
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
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
Afrow UK is offline   Reply With Quote
Old 15th August 2003, 11:33   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Wait, placing two fake urls in screws it up (doesn't get to "urls_start")

I'll find out why...

-Stu
Afrow UK is offline   Reply With Quote
Old 15th August 2003, 11:37   #16
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
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
Afrow UK is offline   Reply With Quote
Old 15th August 2003, 11:40   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
I've ended up using this to fix it:
Push $R0
Exch $R0

Everything works great now.

-Stu
Afrow UK is offline   Reply With Quote
Old 15th August 2003, 11:41   #18
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
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
kichik is offline   Reply With Quote
Old 15th August 2003, 11:41   #19
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Here is latest script:

[edit]Removed SplitString function[/edit]

-Stu
Attached Files
File Type: nsh nsisdl.nsh (6.2 KB, 98 views)

Last edited by Afrow UK; 15th August 2003 at 13:42.
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump