aerDNA
2nd February 2007 18:48 UTC
GetScreenResolution?
Two questions from an NSIS newbie:
1. Is there a way to get the screen resolution on user system? I'm using the BgImage plugin to place text in the center of the screen (hidden behind the installer window) but the AddText and AddImage functions take absolute position values so for the text to be centered on all systems, position should be relative to screen resolution.
2. Does the location of .onInit function within the script matter? I've noticed that in most example scripts it's at the end. When I change its position and generally when I shuffle script elements, functionality remains the same but I get slightly different installer sizes; difference is negligible (a few bytes) but still, I'm wondering... Could someone tell me what's the optimal script structure regarding the compiler (e.g. 1.pages, 2.sections, 3.user functions, 4.callback functions...)?
THX in advance
Red Wine
2nd February 2007 18:57 UTC
1. Is there a way to get the screen resolution on user system? I'm using the BgImage plugin to place text in the center of the screen (hidden behind the installer window) but the AddText and AddImage functions take absolute position values so for the text to be centered on all systems, position should be relative to screen resolution.
http://nsis.sourceforge.net/Get_User...een_resolution2. Does the location of .onInit function within the script matter? I've noticed that in most example scripts it's at the end. When I change its position and generally when I shuffle script elements, functionality remains the same but I get slightly different installer sizes; difference is negligible (a few bytes) but still, I'm wondering... Could someone tell me what's the optimal script structure regarding the compiler (e.g. 1.pages, 2.sections, 3.user functions, 4.callback functions...)?
If you don't change the script structure the produced installers are always identical in size?
aerDNA
3rd February 2007 20:39 UTC
Thanks, Red Wine! The link you posted solves my problem.
And to answer your question, yes, when I recompile the script without changing the structure, the output is always identical in size. But when I, for instance, move .onInit from the beginning to the end of the script, exe is 40 bytes larger. For me it's a bit confusing because I figured it didn't matter to compiler. I might as well mention that I'm running Win98 on P4 (I know, I know...)
Red Wine
3rd February 2007 20:57 UTC
I might as well mention that I'm running Win98 on P4
I guess one may call it an effortless P4 ;)
Joel
4th February 2007 15:44 UTC
Originally posted by aerDNA
But when I, for instance, move .onInit from the beginning to the end of the script, exe is 40 bytes larger.
I would be worried if those bytes were MegaBytes.
aerDNA
4th February 2007 17:02 UTC
Originally posted by Joel
I would be worried if those bytes were MegaBytes.
Of course, you're right, it's nothing to be worried about, I was just wondering why that happens.
kichik
6th February 2007 19:29 UTC
That happens because the data is compressed. Compression results differ not only by the size of the data, but also by the data itself and the order of blocks in it.
aerDNA
7th February 2007 19:37 UTC
Originally posted by kichik
That happens because the data is compressed. Compression results differ not only by the size of the data, but also by the data itself and the order of blocks in it.
Thanks. I know that data order affects compression but it never crossed my mind. The reason of my confusion was that I presumed that the compiler internally restructures the script according to a certain protocol to optimize installer execution and that .onInit code would wind up in the same place no matter where you put it in the script. But it matters, obviously, and your explanation makes perfect sense.