Package and release of QT Software under Win7 platform (using NSIs script to make installation package)

Source: Internet
Author: User

Connect to the above: http://blog.csdn.net/shallen320/article/details/44915649

The above describes how to find the QT program patience, how to use NSIs and. zip files to make a simple compression package. The method used above makes the installation package very simple and does not even create a desktop shortcut. This article describes how to use the NSIs scripting language to create a slightly more complex installation package.

Here is an example of the NSIs scripting language I used, which contains simple and comprehensive features, including:

    • Set installation file version, company, copyright information
    • Installing a copy of the specified file
    • Create Start menu, desktop shortcut
    • Create an uninstaller and uninstall the program in the Windows Control Panel to add a removal program

The script language is as follows and the program is named Terminal:


; Terminal.nsi;; This script was based on Example2.nsi,; have uninstall support and (optionally) installs Start menu shortcuts.; It would install Terminal.nsi into a directory that the user selects,;--------------------------------; The name of the Installername "Terminal"; The file to Writeoutfile "Installer\terminalinstaller.exe"; The default installation Directoryinstalldir C:\Terminal; Registry key to check for directory (so if you install again, it'll; overwrite the old one automatically) Installdirregk EY HKLM "software\nsis_terminal" "Install_dir"; Request application privileges for Windows vistarequestexecutionlevel adminloadlanguagefile "${nsisdir}\contrib\ Language FILES\ENGLISH.NLF ";--------------------------------; Version information viproductversion "0.0.0.1" Viaddversionkey/lang=${lang_english} "ProductName" "Terminal" Viaddver Sionkey/lang=${lang_english} "Comments" "A RS232 Terminal" Viaddversionkey/lang=${lang_english} "CompanyName" "XXX Com Pany "Viaddversionkey /lang=${lang_english} "Legaltrademarks" "YYY is a trademark of XXX company."  Viaddversionkey/lang=${lang_english} "Legalcopyright" "(c) XXX company." Viaddversionkey/lang=${lang_english} "FileDescription" "A RS232 Terminal" Viaddversionkey/lang=${lang_english} " FileVersion "0.0.1";--------------------------------;--------------------------------; Pagespage componentspage directorypage instfilesuninstpage uninstconfirmuninstpage instfiles;---------------------- ----------; The stuff to InstallSection "Terminal (required)" Sectionin RO;  Set output path to the installation directory. Setoutpath $INSTDIR; root folder; Put file There file Icudt53.dll file Icuin53.dll file Icuuc53.dll file Terminal.exe file qt_ca.qm file qt_cs.qm Fil e qt_de.qm file qt_fi.qm file qt_hu.qm file qt_it.qm file qt_ja.qm file qt_ru.qm file qt_sk.qm file qt_uk.qm file Qt5Core.dll file Qt5Gui.dll file Qt5SerialPort.dll file Qt5Svg.dll file Qt5Widgets.dll setoutpath "$INSTDir\iconengines "File" Iconengines\*.* "Setoutpath" $INSTDIR \imageformats "file" Imageformats\*.* "Setoutpath" $INSTDI R\platforms "File" platforms\*.* "; Write the installation path into the registry writeregstr HKLM software\nsis_terminal "Install_dir" "$INSTDIR"; Write the uninstall keys for Windows writeregstr HKLM "Software\microsoft\windows\currentversion\uninstall\terminal" " DisplayName "" Nsis_terminal "Writeregstr HKLM" Software\microsoft\windows\currentversion\uninstall\terminal "" UninstallString "'" $INSTDIR \uninstall.exe "' Writeregdword HKLM" software\microsoft\windows\currentversion\ Uninstall\terminal "" nomodify "1 writeregdword HKLM" Software\microsoft\windows\currentversion\uninstall\terminal "" Norepair "1 Writeuninstaller" Uninstall.exe "sectionend; section "Start Menu shortcuts" createdirectory "$SMPROGRAMS \terminal" Crea, Optional section (Can is disabled by the user) Teshortcut "$SMPROGRAMS \terminal\uninstall.lnk" "$INSTDIR \uninstall.exe" "" "$INSTDIR \Uninstall.exe "0 createshortcut" $SMPROGRAMS \terminal\terminal (MAKENSISW). lnk "" $INSTDIR \terminal.nsi "" "$INSTDIR \ Terminal.nsi "0 sectionendsection" Desktop shortcuts "createshortcut" $DESKTOP \terminal.lnk "" $INSTDIR \terminal.exe "" "Sectionend;--------------------------------; Uninstallersection "Uninstall"; Remove registry keys Deleteregkey HKLM "Software\microsoft\windows\currentversion\uninstall\terminal" Deleteregkey HKLM software\nsis_terminal; Remove files and uninstaller delete "$INSTDIR \*.*" delete "$INSTDIR \scripts\*.*" delete "$INSTDIR \iconengines\*.*" Del Ete "$INSTDIR \imageformats\*.*" Delete "$INSTDIR \platforms\*.*"; Remove shortcuts, if any Delete "$SMPROGRAMS \terminal\*.*" delete "$DESKTOP \terminal.lnk"; Remove directories used RMDir "$INSTDIR \iconengines" RMDir "$INSTDIR \imageformats" RMDir "$INSTDIR \platforms" RMDir "$ Smprograms\terminal "RMDir" $INSTDIR \scripts "RMDir" $INSTDIR "sectionend

Explain:

11 line, Set program name

14 rows, specifying the name and path of the generated installer

17 rows, specifying the default installation path for the installer

30-37 lines, specify the version of the installer, company name, copyright information

56-102 lines, main installation options, required in parentheses indicate that this is a required installation option. This section instructs the installer to install the specified file and write to the specified registry value

103-109 lines, second installation option, Start menu shortcut, optional

111-115-line, third-install option, desktop shortcut, optional

122 Next, uninstall the step. Note It is generally necessary to delete files in a directory before deleting the directory. So first use the delete command, then use the rmdir command


Instructions for use:

Place the script file Xxx.nsi in the source directory of the complete required copy file


Run NSIs, select compile NSI scripts in the upper left corner of the main interface.


Select File-load script later in the interface, or click the Open button in the upper-left corner.


Select the NSIs script file, NSIs automatically executes the file, and if there is no syntax error, the TerminalInstaller.exe installation file is automatically generated to the Installer folder.


Package and release of QT Software under Win7 platform (using NSIs script to make installation package)

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.