NSIs installation and production Basics

Source: Internet
Author: User

Introduction to NSIs:
NSIs is short for "Nullsoft Scriptable installation system". It is a free Win32 installation and uninstallation system. Its features: the script is concise and efficient, and the system overhead is small. Of course, you can install, uninstall, set system settings, and extract files. In other words, you can do almost everything. For more functions, see the blue Internet NSIs help document.
For the NSIs tutorial, blue Internet is an NSIs expert. Her NSIs help document is an NSIs Bible. For Beginners, the biggest headache is a lot of unintelligible code, which is nothing more than a book. Due to this, we hope NSIs experts will not laugh at this basic tutorial. If not, we welcome criticism and correction for perfection. We also hope to pave the way for beginners.
Tools:NIS edit + Nullsoft installation system (NSIs)
Ideas:Script wizard + code modification = personalized installation package
Steps:
I. Use the Wizard to create the installation package
01. Install the above two models. Start NIS edit and choose "New Script: Wizard"> "Next" from the "file" menu.

02. Set application information, such as the software name, version, and publisher. 2. Of course, you can leave it blank for the most website. If it is set, the installation package will generate an "Internet shortcut" for the corresponding website ".

03. Set program options, such as the installation package icon, installation program file, installation package language [select "simchinese"], user graphical interface, and compression mode. we can select the default value, you can also click the corresponding project button or drop-down menu to change the settings, 3.

04. Set the installation directory and authorization information. 4. "Next ".

05. Select a program file, that is, the file to be packaged. You can use the default "mainsection" or change or create a group as needed. If there are many groups, you can also set whether to "allow users to select components to install", 5.

After adding a file, select the file we want to package, 6, and then complete the page in Figure 5 Returned automatically, and perform the next step.

06. Set the folder name and shortcut in the Start Menu. Here we use the default value. 7. Click "Next ".

07. Specify the program to run after installation. Use the default value and set relevant running parameters and descriptions. leave it blank if you are as lazy as you are or do not want to install or run any program, 8.

08. This step contains information about the uninstall program, such as the prompt during uninstallation, the uninstallation icon, and so on. 9.

09. Now the Wizard is complete. 10. Select "Save script", "convert file path to relevant path", and "compile script ".

The system prompts you to save the script path and automatically compile the script. You can press or F9 to run the installer for preview, as shown in installation package 11 generated by the wizard.

Ii. modify the code to customize the installation package
10. Select the modifiable items. Software logo [11A], installation package title [fig 11B], fig 11C, Fig 12, Fig 13.
Figure 11 see upstairs Figure 12 below

Figure 13:

11. modify the code
① Modify the software logo: Add the following code after the source code "Mui Settings:

The following is a code snippet:
! Define mui_welcomefinishpage_bitmap "G: \ temp \ pwr.bmp"

Note: the path of the bitmap is enclosed in quotation marks. The bitmap size is about 165*298.
14.

② Modify the installation package title and add the following code at the same location:

The following is a code snippet:
! Define mui_welcomepage_title "\ r \ n release 2All 5.35d Chinese version"

Note: \ r \ n indicates a line feed.
Go upstairs 14.
③ Modify the description in Figure 11c and add the following code as above:

The following is a code snippet:
! Define mui_welcomepage_text "pdf2all is a set of converters that can be converted to doc2pdf (word to PDF), xls2pdf (Excel sheet to PDF), ppt2pdf (PowerPoint to PDF ), mdb2pdf (access to PDF), ps2pdf (postscript to PDF), 4102jpg (PDF to JPEG), 4102bmp (PDF to BMP), 4102tiff (PDF to TIFF ), pdf2eps (PDF to EPS), merge Merge (merged pdf file), and merge 2ppt (PDF to PowerPoint ). \ R \ n software: Gao fangyan (raindy) \ r \ n \ r \ N $ _ click"

14.
④ Modify the modification in Figure 12 in the source code:

The following is a code snippet:
Showinstdetails show
Showuninstdetails show

Add:

The following is a code snippet:
Brandingtext "Software Localization: raindy )"

As shown in Figure 15.

⑤ Add "Chinese description" after completion, as long as it is in the source code:

The following is a code snippet:
; Finish page

Add:

The following is a code snippet:
! Define mui_finishpage_showreadme "$ instdir \ Definition description .txt"
! Define mui_finishpage_showreadme_text "Chinese description"

Results

6. You can add the following code to the source code on the screen:
A. Common effects

The following is a code snippet:
Function. oninit
Setoutpath $ temp
File/oname?spltmp.bmp "G: \ temp \ nsisres \ splash.bmp"
Splash: Show 2300 $ Temp \ spltmp
Pop $0
Functionend

B. Gradient Screen

The following is a code snippet:
Function. oninit
Initpluginsdir
File/oname = $ pluginsdir \ splash.bmp "G: \ temp \ nsisres \ splash.bmp"
Advsplash: Show 1500 800 600-1 $ pluginsdir \ splash
Functionend

7. Background Music [installation process]

The following is a code snippet:
VaR hmci
Function. oninit
Initpluginsdir
Setoutpath $ pluginsdir
File "G: \ temp \ nsisres \ musicloud" [Description: storage path of the source MP3 file]
System: Call msvfw32.dll: mciwndcreate (I 0, I 0, I 0x0070, t "$ pluginsdir \ musicloud") I. R0
Sendmessage $0 0x0465 0 "str: Play repeat"
System: Call user32.dll: showwindow (I r0, I 0)
Strcpy $ hmci $0
Functionend
Section
; Add your codes
Sendmessage $ hmci 0x0010 0 0
Sectionend

Background:
The above is only the most basic operation for NSIs to create an installation package for beginners ". I hope that I will not smile and be more generous. I also hope that blue MM, Chen minyi, and other senior NSIs experts will provide intermediate and senior tutorials.
Excellent code(^-^)
1. Pop-up screen effect (fading)

The following is a code snippet:
Function. oninit
Initpluginsdir
File/oname = $ pluginsdir \ splash.bmp c: \ test.bmp
Advsplash: Show 1500 800 600-1 $ pluginsdir \ splash
Functionend

2. Background Music 1 (throughout the installation process)

The following is a code snippet:
Function. oninit
Initpluginsdir
Setoutpath $ pluginsdir
File "C: \ a.mp3"
System: Call msvfw32.dll: mciwndcreate (I 0, I 0, I 0x0070, t "$ pluginsdir \ a.mp3") I. R0
Sendmessage $0 0x0465 0 "str: Play repeat"
System: Call user32.dll: showwindow (I r0, I 0)
Strcpy $ hmci $0
Functionend
Section
; Add your codes
Sendmessage $ hmci 0x0010 0 0
Sectionend

3. Background Music 2

The following is a code snippet:
Section/Function
Setoutpath $ pluginsdir
File $ WinDir \ media \ chimes.wav
Bgimage: Sound/nounload/Wait "$ pluginsdir \ chimes.wav"
Bgimage: Clear/nounload
Sectionend/functionend

4. Pop-up effects [fade-In] + background music [full process]

The following is a code snippet:
OUTFILE test.exe
VaR hmci
Function. oninit
Initpluginsdir
Setoutpath $ pluginsdir
File "C: \ a.mp3"
System: Call msvfw32.dll: mciwndcreate (I 0, I 0, I 0x0070, t "$ pluginsdir \ a.mp3") I. R0
Sendmessage $0 0x0465 0 "str: Play repeat"
System: Call user32.dll: showwindow (I r0, I 0)
Strcpy $ hmci $0
File/oname = $ pluginsdir \ splash.bmp c: \ test.bmp
Advsplash: Show 1500 800 600-1 $ pluginsdir \ splash
Functionend
Section
; Add your codes
Sleep 5000
Sendmessage $ hmci 0x0010 0 0
Sectionend

5. How to install setup on the installation page ......" Change setup to another word in
You only need

The following is a code snippet:
! Insertmacro mui_page_directory

Add a row above

The following is a code snippet:
! Define mui_directorypage_text_top "text you need"

6. Set the custom installation and uninstallation icons.

The following is a code snippet:
! Define mui_icon "G: \ temp \ nsisres \ win installation. ICO"
! Define mui_unicon "G: \ temp \ nsisres \ win Uninstall. ICO"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.