Skip to content

Inno Setup Compiler code (Setup.exe) repack #2041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions InnoSetupCompiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Inno Setup Installer for TrafficMonitor

## Overview
This repository contains an **Inno Setup script** that creates an installer for the **TrafficMonitor** application. The installer will allow users to easily install TrafficMonitor on their Windows machines.

### Features:
- Creates a simple installer to package the TrafficMonitor app.
- Allows users to choose the installation directory.
- Optionally creates shortcuts on the desktop and in the Start menu.
- Supports automatic launching after installation.

## Motivation
The TrafficMonitor app is a useful tool for monitoring network traffic, but users may find it difficult to install and configure manually. With this Inno Setup script, we can simplify the installation process, making it easier for users to get started with the app. The installer will handle the necessary files and configuration automatically, reducing setup time and user errors.

## How It Works
The Inno Setup script will perform the following steps:

1. **File Installation**:
- The app’s executables, libraries, and configuration files will be copied to the specified installation directory (default is `C:\Program Files\TrafficMonitor`).

2. **Shortcuts**:
- A shortcut to TrafficMonitor will be created on the desktop and in the Start menu.

3. **Post-installation Launch**:
- After installation, TrafficMonitor will be automatically launched unless the user opts out during the installation process.

4. **Uninstallation**:
- The installer also supports clean uninstallation through the "Add/Remove Programs" menu in Windows.

## How to Use the Inno Setup Script

1. **Install Inno Setup**:
- Download and install [Inno Setup](http://www.jrsoftware.org/isinfo.php).

2. **Prepare Files**:
- Ensure all necessary files for TrafficMonitor (e.g., `TrafficMonitor.exe`, configuration files, etc.) are in the correct directories on your computer.

3. **Modify the Script**:
- Update the script with the correct file paths for your project. For example, change the paths in the `[Files]` section to point to the correct locations of your executables and resources.

4. **Compile the Script**:
- Open the Inno Setup Compiler, load the `.iss` script, and click "Compile" to generate the installer.

5. **Distribute the Installer**:
- Once the installer is created, distribute the `.exe` file. Users can simply run the installer to install TrafficMonitor.

6. **Uninstall**:
- If users want to uninstall TrafficMonitor, they can do so from the "Add or Remove Programs" menu in Windows, and the installer will remove all the installed files.


## Conclusion

This Inno Setup script makes it easy to create an installer for the TrafficMonitor app. By following the steps above, you can generate a customized installer that simplifies the installation process for your users. Feel free to modify the script to meet your needs, and don't hesitate to contribute improvements or report issues!

If you have any questions, feel free to open an issue on GitHub, and I'll be happy to help.

Happy coding!
102 changes: 102 additions & 0 deletions InnoSetupCompiler/Setup.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
[Code]
// Function to check if the app is already installed by reading the registry
function InitializeSetup(): Boolean;
var
InstalledVersion: string;
begin
// Check if the app is already installed by querying the registry
if RegQueryStringValue(HKCU, 'Software\MyCompany\TrafficMonitor', 'Version', InstalledVersion) then
begin
MsgBox('A previous version (' + InstalledVersion + ') of Traffic Monitor is already installed. Installation will proceed with the new version.', mbInformation, MB_OK);
end
else
begin
MsgBox('No previous version found. Proceeding with installation of Traffic Monitor.', mbInformation, MB_OK);
end;

Result := True; // Allow setup to continue
end;
#define MyAppName "Traffic Monitor"
#define MyAppVersion "1.85.1"
#define MyAppPublisher "zhongyang219"
#define MyAppURL "https://github.com/zhongyang219/TrafficMonitor"
// #define groupname ""
#define OutputDir "./output"
#define IconFile "./TrafficMonitor.ico"

[Setup]
AppId={{B07BBDF1-7889-4816-A970-E43D611A24D1}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
ArchitecturesInstallIn64BitMode="x64os"
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputDir={#OutputDir}
OutputBaseFilename={#MyAppName}_{#MyAppVersion}
SetupIconFile={#IconFile}
SolidCompression=yes
WizardStyle=modern

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "arabic"; MessagesFile: "compiler:Languages\Arabic.isl"
Name: "armenian"; MessagesFile: "compiler:Languages\Armenian.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "bulgarian"; MessagesFile: "compiler:Languages\Bulgarian.isl"
Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
Name: "korean"; MessagesFile: "compiler:Languages\Korean.isl"
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "swedish"; MessagesFile: "compiler:Languages\Swedish.isl"
Name: "tamil"; MessagesFile: "compiler:Languages\Tamil.isl"
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"

[Registry]
Root: HKCU; Subkey: "Software\MyCompany\TrafficMonitor"; ValueName: "InstallPath"; ValueType: string; ValueData: "{app}"
Root: HKCU; Subkey: "Software\MyCompany\TrafficMonitor"; ValueName: "Version"; ValueType: string; ValueData: "{#MyAppVersion}"

[Files]
Source: "Source\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\TrafficMonitor.exe"; WorkingDir: "{app}"; IconFilename: "{app}\TrafficMonitor.ico"; Tasks: desktopicon
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\TrafficMonitor.exe"; WorkingDir: "{app}"; IconFilename: "{app}d\TrafficMonitor.ico"; Tasks: startmenuicon

[Tasks]
Name: "desktopicon"; Description: "Create a desktop shortcut"; GroupDescription: "Additional tasks";
Name: "startmenuicon"; Description: "Create a Start Menu shortcut"; GroupDescription: "Additional tasks";

[Messages]
WelcomeMessage=Welcome to the {#MyAppName} {#MyAppVersion} Setup Wizard!
ExitMessage=Thank you for installing {#MyAppName}. We hope you enjoy using it!

[UninstallDelete]
Type: files; Name: "{app}\TrafficMonitor.exe"
Type: dirifempty; Name: "{app}"

; [Setup]
; CustomBackgroundFile=./background.bmp


Binary file added InnoSetupCompiler/TrafficMonitor.ico
Binary file not shown.
Binary file not shown.