如何使用Inno Setup创建桌面图标 [英] How to create a desktop icon with Inno Setup

查看:1057
本文介绍了如何使用Inno Setup创建桌面图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Inno Setup的新手,我希望在Inno Setup中的可执行文件中添加一个Desktop图标。该文件存储在

  C:\Users\PycharmProjects\GIOTTOconverter\dist\giotto.ico 

我尝试举几个例子,但没有结果。

 ;由 Inno安装脚本向导生成的脚本。 
;有关创建INNO设置脚本文件的详细信息,请参见文档!

#定义MyAppName GIOTTO
#定义MyAppVersion 1.0
#定义MyAppExeName GIOTTO.exe

[设置]
;注意:AppId的值唯一标识此应用程序。
;不要在其他应用程序的安装程序中使用相同的AppId值。
; (要生成新的GUID,请在IDE中单击工具 |生成GUID。)
AppId = {{48A8A469-1711-46FD-AC87-1596EF57C123}
AppName = {#MyAppName}
AppVersion = {#MyAppVersion}
; AppVerName = {#MyAppName} {#MyAppVersion}
DefaultDirName = {pf} \ {#MyAppName}
DefaultGroupName = {#MyAppName}
AllowNoIcons =是
OutputBaseFilename = GiottoSetup
SetupIconFile = C:\Users\PycharmProjects\GIOTTOconverter\dist\giotto.ico
Compression = lzma
SolidCompression = yes

[语言]
名称:英语; MessagesFile: compiler:Default.isl
名称: french; MessagesFile: compiler:Languages\French.isl
名称: italian; MessagesFile: compiler:Languages\Italian.isl
名称: spanish; MessagesFile: compiler:Languages\Spanish.isl

[任务]
名称: desktopicon;说明: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons};标志:未选中的
名称: quicklaunchicon;说明: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons};标志:未选中; OnlyBelowVersion:0,6.1

[文件]
来源: C:\Users\PycharmProjects\GIOTTOconverter\dist\GIOTTO.exe; DestDir: {app};标志:ignoreversion
来源: C:\Users\PycharmProjects\GIOTTOconverter\dist\ *; DestDir: {app};标志:ignoreversion recursesubdirs createallsubdirs
;注意:请勿在任何共享系统文件

[图标]
上使用标志:ignoreversion名称: {group} \ {#MyAppName};文件名: {app} \ {#MyAppExeName}
名称: {group} \ {cm:UninstallProgram,{#MyAppName}};文件名: {uninstallexe}
名称: {commondesktop} \ {#MyAppName};文件名: {app} \ {#MyAppExeName};任务:desktopicon
名称: {userappdata} \Microsoft\Internet Explorer\Quick Launch\ {#MyAppName};文件名: {app} \ {#MyAppExeName};任务:quicklaunchicon

[运行]
文件名: {app} \ {#MyAppExeName};说明: {cm:LaunchProgram,{#StringChange(MyAppName,&,‘&&’)}};标志:nowait postinstall skipifsilent


解决方案

[Files] 部分,则安装了 giotto.ico 到应用程序文件夹(您可能只想在选择 desktopicon 任务时安装图标)。 / p>

[图标] 部分,则使用安装的 giotto.ico 创建桌面图标(当 desktopicon 任务被选中。)

  #define SourcePath C:\Users\PycharmProjects\ GIOTTOconverter\dist 
#定义MyAppName GIOTTO
#定义MyAppExeName GIOTTO.exe
#定义MyAppIcoName giotto.ico

[任务]
名称: desktopicon;说明: {cm:CreateDesktopIcon}; \
GroupDescription: {cm:AdditionalIcons};标志:未选中

[文件]
来源: {#SourcePath} \ {#MyAppExeName}; DestDir: {app};标志:ignoreversion
来源: {#SourcePath} \ {#MyAppIcoName}; DestDir: {app}

[图标]
名称: {userdesktop} \ {#MyAppName};文件名: {app} \ {#MyAppExeName}; \
IconFilename: {app} \ {#MyAppIcoName};任务:desktopicon






尽管可执行文件( GIOTTO.exe )具有链接到的相同图标,您无需单独安装该图标。只需使用EXE文件中的图标即可:

  #define SourcePath C:\Users\PycharmProjects\GIOTTOconverter\ dist 
#define MyAppName GIOTTO
#define MyAppExeName GIOTTO.exe

[任务]
名称: desktopicon;说明: {cm:CreateDesktopIcon}; \
GroupDescription: {cm:AdditionalIcons};标志:未选中

[文件]
来源: {#SourcePath} \ {#MyAppExeName}; DestDir: {app};标志:ignoreversion

[图标]
名称: {userdesktop} \ {#MyAppName};文件名: {app} \ {#MyAppExeName};任务:desktopicon


I am very new of Inno Setup and I wish to add a Desktop icon to my executable in Inno Setup. The file is stored in

C:\Users\PycharmProjects\GIOTTOconverter\dist\giotto.ico

I tried to follow several examples but without results.

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "GIOTTO"
#define MyAppVersion "1.0"
#define MyAppExeName "GIOTTO.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{48A8A469-1711-46FD-AC87-1596EF57C123}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputBaseFilename=GiottoSetup
SetupIconFile=C:\Users\PycharmProjects\GIOTTOconverter\dist\giotto.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:\Users\PycharmProjects\GIOTTOconverter\dist\GIOTTO.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\PycharmProjects\GIOTTOconverter\dist\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
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

解决方案

In [Files] section, you install your giotto.ico to the application folder (you may want to install the icon only when the desktopicon task is selected).

In [Icons] section, you create the desktop icon using the installed giotto.ico (when the desktopicon task is selected).

#define SourcePath "C:\Users\PycharmProjects\GIOTTOconverter\dist"
#define MyAppName "GIOTTO"
#define MyAppExeName "GIOTTO.exe"
#define MyAppIcoName "giotto.ico"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
    GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "{#SourcePath}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}\{#MyAppIcoName}"; DestDir: "{app}"

[Icons]
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; \
    IconFilename: "{app}\{#MyAppIcoName}"; Tasks: desktopicon


Though if the executable file (GIOTTO.exe) has the same icon linked into, you do not need to install the icon separately. Just use the icon from the EXE file:

#define SourcePath "C:\Users\PycharmProjects\GIOTTOconverter\dist"
#define MyAppName "GIOTTO"
#define MyAppExeName "GIOTTO.exe"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
    GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "{#SourcePath}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

这篇关于如何使用Inno Setup创建桌面图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆