Archive: Brandingimage


Brandingimage
OK.

Working my way through this scripting stuff. Been able to do just about everything I need, but I'm confused about Brandingimage.

I have a 400x60 bmp image.
In my script, I have:

AddBrandingImage top 400|60

Section "MISC"
SetBrandingImage "$OUTDIR\brandingimage.bmp"
SectionEnd

Since it seems BrandingImage needs to be in its own section. I've also included the brandingimage.bmp as part of a File command.

Also, what format can the image be?
16 colors?
256 colors?
24 bit?
PNG? Ooo. with Alpha Transparency? Heheheh.

Any help/examples would be hot.


The | sign means or. Not both, height or width. The branding image must be a bitmap. It can use any color palette though. Have a look at gfx.nsi for an example of usage.


I did look through the gfx example; however, I still can't get it to work. It's difficult to integrate two examples into one. I'm also using Joost's modernUI.exe script as well.

I'm still having issues getting a graphic to show up.

What section does the BMP need to be in?
Why is it necessary to include it in the FILE section?

I'm getting there... but might need some more assistance.

I'd say I'm intermediate, but not "pro" super pimp yet.


The only place you can't set a branding image is .onInit because there is no dialog yet when it executes. All you have to do is extract the bitmap (using File), and then setting it to the branding control.

GetTempFileName $0
File /oname=$0 mybitmap.bmp
SetBrandingImage $0
Delete $0

That's it. Put it in .onNextPage for example. gfx.nsi shows you how to do add more than one easily.

You have to use File because you must put the bitmap on the user machine. SetBrandingImage doesn't add it to the installer for you.


See, here's where my ignorance and education come in.
I promise I *have* read the HTML stuff. And I am making good progress...

But how do I get the BMP file to extract BEFORE the setup takes place?
The gfx.nsi calls another file with macros and stuff, and it's hard to follow.

I understand that the BMP has to be on the target machine FIRST. And deleting it may be premature because you might want it to be deleted in the Uninstallation section..


I *think* that the .onNextPage callback function will get called just before the first page is shown (and many other times of course but for the purpose right now we don't care about that) but *after* the dialog has been created... so in .onNextPage have a File command to unpack the bitmap and then the commands to use the bitmap as your branding imagery. You then just need to put these commands in an if block so they only get executed the first time .onNextPage is called.


You don't have to get it there before the setup starts, just before the setup calls SetBrandingImage, and you tell it when to call it. The setup doesn't relay on the branding image, it just uses it. The branding image is dynamic.

If you want it for the uninstaller too, just extract it there too.

The branding header file tells you less, but makes you write less too. All you have to do with it is insert !BI_INIT where you want to initialize, BI_NEXT when you want to move to the next image, and BI_PREV when you want to move back to the previous one. You also have to define you images list starting with BI_LIST and then just add all your images with BI_LIST_ADD and finish with BI_LIST_END. It will extract all the images for you.


Ok. I'm starting to get it...
Do I need to call any other file (branding.?) to use those shortcuts?
Right now, I'm creating function on.NextPage and function un.on.Nextpage or whatever...


You just need to include branding.nsh, just like in the example. Just add !include "${NSISDIR}\Examples\branding.nsi" to your script.

If you wish to use it in the uninstaller, define BI_UNINSTALL and include it again. Just make sure all of the usage of the newly defined uninstall macros is in the uninstaller, just like in gfx.nsi.


Originally posted by Tolwyn
Ok. I'm starting to get it...
Do I need to call any other file (branding.?) to use those shortcuts?
Right now, I'm creating function on.NextPage and function un.on.Nextpage or whatever...
You need to include branding.nsh (have a look at gfx.nsi).

[edit]kichik, you are just too fast :D[/edit]