NSIS 是“Nullsoft 腳本安裝系統(tǒng)”(Nullsoft Scriptable InstallationSystem)的縮寫,它是一個(gè)免費(fèi)的 Win32安裝、卸載系統(tǒng)。它的特點(diǎn):腳本簡潔高效;系統(tǒng)開銷小;當(dāng)然進(jìn)行安裝、卸載、設(shè)置系統(tǒng)設(shè)置、解壓文件等等更不在話下,幾乎可以做所有的事情。更多的功能請閱讀藍(lán)色網(wǎng)際的《NSIS幫助文檔》。
對于制作NSIS的使用教程,藍(lán)色網(wǎng)際是NSIS方面的專家,她的《NSIS幫助文檔》就是一本NSIS的圣經(jīng),而對初學(xué)者來說,最頭疼的莫過于一大堆看不懂的代碼,對他們來說無異于一本天書。緣于此,特草此基礎(chǔ)教程,希望NSIS專家們勿見笑,不當(dāng)之處歡迎批評指正以期完善,也希望給初學(xué)者作個(gè)鋪墊。
工具: NIS Edit+Nullsoft Installation System(NSIS)
思路: 腳本向?qū)В薷拇a=個(gè)性化安裝包
步驟:
一、利用向?qū)е谱靼惭b包
01、安裝上述兩款,啟動(dòng)NIS Edit,在“文件”菜單中“新建腳本:向?qū)?#8221;→下一步”,如圖1。
02、設(shè)置應(yīng)用程序信息,如軟件名稱、版本、出版人等,如圖2。當(dāng)然最一個(gè)網(wǎng)站可以留空,如果設(shè)置了,則安裝包會生成一個(gè)對應(yīng)網(wǎng)址的“Internet 快捷方式”。
以下是代碼片段: !define MUI_WELCOMEFINISHPAGE_BITMAP "G:\temp\ pwr.bmp" |
以下是代碼片段: !define MUI_WELCOMEPAGE_TITLE "\r\n PDF2all 5.35d 漢化版" |
以下是代碼片段: !define MUI_WELCOMEPAGE_TEXT " pdf2all是一個(gè)轉(zhuǎn)換器的集合,它能轉(zhuǎn)換包括 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 "你需要的文字" |