NSIS简介:
NSIS 是“Nullsoft 脚本安装系统”(Nullsoft Scriptable Installation System)的缩写,它是一个免费的 Win32 安装、卸载系统。它的特点:脚本简洁高效;系统开销小;当然进行安装、卸载、设置系统设置、解压文件等等更不在话下,几乎可以做所有的事情。更多的功能请 阅读蓝色网际的《NSIS帮助文档》。
对于制作NSIS的使用教程,蓝色网际是NSIS方面的专家,她的《NSIS帮助文档》就是一本NSIS的圣经,而对初学者来说,最头疼的莫过于一大 堆看不懂的代码,对他们来说无异于一本天书。缘于此,特草此基础教程,希望NSIS专家们勿见笑,不当之处欢迎批评指正以期完善,也希望给初学者作个铺 垫。
工具:NIS Edit+Nullsoft Installation System(NSIS)
思路:脚本向导+修改代码=个性化安装包
步骤:
一、利用向导制作安装包
01、安装上述两款,启动NIS Edit,在“文件”菜单中“新建脚本:向导”→下一步”,如图1。

02、设置应用程序信息,如软件名称、版本、出版人等,如图2。当然最一个网站可以留 空,如果设置了,则安装包会生成一个对应网址的“Internet 快捷方式”。












| 以下是代码片段: !define MUI_WELCOMEFINISHPAGE_BITMAP "G:\temp\ pwr.bmp" |

| 以下是代码片段: !define MUI_WELCOMEPAGE_TITLE "\r\n PDF2all 5.35d 汉化版" |
| 以下是代码片段: !define MUI_WELCOMEPAGE_TEXT " pdf2all是一个转换器的集合,它能转换包括 doc2pdf (Word to PDF),xls2pdf (Excel Sheet到PDF),ppt2pdf(PowerPoint到 PDF),mdb2pdf (Access到PDF),ps2pdf(PostScript到PDF),pdf2jpg(PDF到 JPEG),pdf2bmp(PDF到BMP),pdf2tiff(PDF到TIFF),pdf2eps(PDF到EPS),pdfMerge(合并 PDF文件),pdf2ppt(PDF到PowerPoint)。\r\n\r\n 软件汉化:高芳銮 (Raindy)\r\n\r\n $_CLICK" |
| 以下是代码片段: ShowInstDetails show ShowUnInstDetails show |
| 以下是代码片段: BrandingText " 软件汉化:高芳銮 (Raindy)" |

| 以下是代码片段: ; Finish page |
| 以下是代码片段: !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\汉化说明.txt" !define MUI_FINISHPAGE_SHOWREADME_TEXT "汉化说明" |

| 以下是代码片段: Function .onInit SetOutPath $TEMP File /oname=spltmp.bmp "G:\Temp\Nsisres\splash.bmp" splash::show 2300 $TEMP\spltmp Pop $0 FunctionEnd |
| 以下是代码片段: Function .OnInit InitPluginsDir File /oname=$PLUGINSDIR\splash.bmp "G:\Temp\Nsisres\splash.bmp" advsplash::show 1500 800 600 -1 $PLUGINSDIR\splash Functionend |
| 以下是代码片段: Var hmci Function .OnInit InitPluginsDir SetOutPath $PLUGINSDIR File "G:\Temp\Nsisres\music.mp3" [说明:源MP3的存放路径] System::Call msvfw32.dll::MCIWndCreate(i 0, i 0,i 0x0070, t "$PLUGINSDIR\music.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 |
| 以下是代码片段: Function .OnInit InitPluginsDir File /oname=$PLUGINSDIR\splash.bmp c:\test.bmp advsplash::show 1500 800 600 -1 $PLUGINSDIR\splash Functionend |
| 以下是代码片段: 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 |
| 以下是代码片段: Section/Function SetOutPath $PLUGINSDIR File $WINDIR\MEDIA\chimes.wav BgImage::Sound /NOUNLOAD /WAIT "$PLUGINSDIR\chimes.wav" BgImage::Clear /NOUNLOAD Sectionend/Functionend |
| 以下是代码片段: 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 |
| 以下是代码片段: !insertmacro MUI_PAGE_DIRECTORY |
| 以下是代码片段: !define MUI_DIRECTORYPAGE_TEXT_TOP "你需要的文字" |
!define MUI_ICON "G:\Temp\Nsisres\Win 安装.ico"
!define MUI_UNICON "G:\Temp\Nsisres\Win 卸载.ico"