分享个INNO打包Windows应用程序完整实例脚本(转载)
生活随笔
收集整理的這篇文章主要介紹了
分享个INNO打包Windows应用程序完整实例脚本(转载)
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
最近手賤,把以前寫的一個完整的INNO打包腳本給刪了,于是又得到處找資料學習。現(xiàn)在分享一個完整的腳本代碼,以后就不會找不到了。腳本為完整diamante,包括了這些基本的功能:寫注冊表、檢測程序是否正在運行、調(diào)用exe、配置生成文件相關屬性等。
; 腳本由 Inno Setup 腳本向?qū)?生成! ; 有關創(chuàng)建 Inno Setup 腳本文件的詳細資料請查閱幫助文檔!#define MyAppName "××××" #define MyAppVersion "2.3.29.15" #define MyAppPublisher "有限公司" #define MyAppURL "http://www.******.com/" #define MyAppExeName "******.exe" ;#define MyProgramsMutexName "C0BD666C-45AB-48D2-AAA8-C535E624134C" [Setup] ; 注: AppId的值為單獨標識該應用程序。 ; 不要為其他安裝程序使用相同的AppId值。 ; (生成新的GUID,點擊 工具|在IDE中生成GUID。) AppId={{C0BD666C-45AB-48D2-AAA8-C535E624134C} ;AppMutex={#MyProgramsMutexName} AppName={#MyAppName} AppVersion={#MyAppVersion} AppVerName={#MyAppName} {#MyAppVersion} VersionInfoProductVersion={#MyAppVersion} VersionInfoProductTextVersion={#MyAppVersion} VersionInfoVersion={#MyAppVersion} VersionInfoCompany={#MyAppPublisher} VersionInfoCopyright={#MyAppPublisher}{#'版權所有'} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DefaultGroupName={#MyAppName}OutputDir=C:\Users\Jelin\Desktop\InnoOut OutputBaseFilename=MySetup{#MyAppVersion} SetupIconFile=******\res\*****.ico Compression=lzma SolidCompression=yes[Languages] Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"[Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1 Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked[Files] Source: "E:\<span style="font-family: Arial, Helvetica, sans-serif;">******</span><span style="font-family: Arial, Helvetica, sans-serif;">\Release\****.exe"; DestDir: "{app}"; Flags: ignoreversion</span> Source: "E:\*****\Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; 注意: 不要在任何共享系統(tǒng)文件上使用“Flags: ignoreversion”[Icons] Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon[Run] Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent[UninstallRun] Filename: "{app}\******.exe"; Parameters: "/uninstall";注冊表啟動項 [Registry] Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "testrun"; ValueData: "{app}\{#MyAppExeName}" Root: HKLM; Subkey: "Software\**********"; ValueType: string; ValueName: "version"; ValueData: "{#MyAppVersion}" Root: HKLM; Subkey: "Software\<span style="font-family: Arial, Helvetica, sans-serif;">**********</span><span style="font-family: Arial, Helvetica, sans-serif;">"; ValueType: string; ValueName: "path"; ValueData: "{app}"</span>;安裝時判斷客戶端是否正在運行 [Code]function InitializeSetup(): Boolean; var IsRunning: Integer; begin Result :=true; //安裝程序繼續(xù) IsRunning:=FindWindowByClassName('UIMainFrame'); ;檢查程序是否正在運行while IsRunning<>0 do begin if Msgbox('安裝程序檢測到********正在運行。' #13#13 '您必須先關閉它然后單擊“是”繼續(xù)安裝,或按“否”退出!', mbConfirmation, MB_YESNO) = idNO then begin Result :=false; //安裝程序退出 IsRunning :=0; end else begin Result :=true; //安裝程序繼續(xù) IsRunning:=FindWindowByClassName('UIMainFrame'); end; end; end;function InitializeUninstall(): boolean; var IsRunning: Integer; beginResult:= true;IsRunning:= FindWindowByClassName('UIMainFrame'); beginif IsRunning<>0 thenbeginMsgBox('******正在運行,請先關閉它!', mbConfirmation, MB_OK);Result:= false;endelsebeginResult:= trueend;end; end;?
轉載于:https://www.cnblogs.com/Joetao/articles/6115730.html
總結
以上是生活随笔為你收集整理的分享个INNO打包Windows应用程序完整实例脚本(转载)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PhotoSwipe 图片浏览插件使用方
- 下一篇: kvm cobbler无人值守批量安装操