diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 432e915..7597a07 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -259,7 +259,14 @@ jobs: Copy-Item "files\Encryption Wizard User Guide v405.pdf" "$archiveDir\" Copy-Item "files\Getting_Started_with_Encryption_Wizard_4.0.005.txt" "$archiveDir\" Copy-Item "files\Drop_Jar_File_Here_For_Fallback_Launch.bat" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.bat" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.ps1" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.vbs" "$archiveDir\" Copy-Item "files\Encryption Wizard homepage.url" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.vbs" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.ps1" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.bat" "$archiveDir\" + Copy-Item "files\SHORTCUT_CREATION_README.md" "$archiveDir\" # Application graphics (icon and splash image) Copy-Item "build\icon.ico" "$archiveDir\" diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index c9c0cb0..fe1bd2e 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -256,7 +256,14 @@ jobs: Copy-Item "files\Encryption Wizard User Guide v405.pdf" "$archiveDir\" Copy-Item "files\Getting_Started_with_Encryption_Wizard_4.0.005.txt" "$archiveDir\" Copy-Item "files\Drop_Jar_File_Here_For_Fallback_Launch.bat" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.bat" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.ps1" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.vbs" "$archiveDir\" Copy-Item "files\Encryption Wizard homepage.url" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.vbs" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.ps1" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.bat" "$archiveDir\" + Copy-Item "files\SHORTCUT_CREATION_README.md" "$archiveDir\" # Application graphics (icon and splash image) Copy-Item "build\icon.ico" "$archiveDir\" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ea8fb53..c39b0aa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -255,7 +255,14 @@ jobs: Copy-Item "files\Encryption Wizard User Guide v405.pdf" "$archiveDir\" Copy-Item "files\Getting_Started_with_Encryption_Wizard_4.0.005.txt" "$archiveDir\" Copy-Item "files\Drop_Jar_File_Here_For_Fallback_Launch.bat" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.bat" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.ps1" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.vbs" "$archiveDir\" Copy-Item "files\Encryption Wizard homepage.url" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.vbs" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.ps1" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.bat" "$archiveDir\" + Copy-Item "files\SHORTCUT_CREATION_README.md" "$archiveDir\" # Application graphics (icon and splash image) Copy-Item "build\icon.ico" "$archiveDir\" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ca976b4..a1ddd21 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -257,7 +257,14 @@ jobs: Copy-Item "files\Encryption Wizard User Guide v405.pdf" "$archiveDir\" Copy-Item "files\Getting_Started_with_Encryption_Wizard_4.0.005.txt" "$archiveDir\" Copy-Item "files\Drop_Jar_File_Here_For_Fallback_Launch.bat" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.bat" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.ps1" "$archiveDir\" + Copy-Item "files\Launch_Encryption_Wizard.vbs" "$archiveDir\" Copy-Item "files\Encryption Wizard homepage.url" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.vbs" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.ps1" "$archiveDir\" + Copy-Item "files\Create_Desktop_Shortcut.bat" "$archiveDir\" + Copy-Item "files\SHORTCUT_CREATION_README.md" "$archiveDir\" # Application graphics (icon and splash image) Copy-Item "build\icon.ico" "$archiveDir\" diff --git a/README.md b/README.md index 25cadf6..05739ad 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,28 @@ # em-win Encryption Wizard bundling repo for windows that includes a launch4j exe launcher, JRE, and installer + +## Features + +- Windows installer (Inno Setup) with per-user and system-wide installation options +- Portable ZIP archive with bundled JRE +- Launch4j-generated EXE with embedded JAR +- Desktop shortcut creation utilities for easy access +- File type associations for `.wza`, `.wzd`, and `.wzk` files + +## Desktop Shortcut Creation + +The bundle includes three utilities to create a desktop shortcut that uses the bundled JRE to launch Encryption Wizard: + +- `Create_Desktop_Shortcut.bat` - Batch file (recommended for most users) +- `Create_Desktop_Shortcut.ps1` - PowerShell script +- `Create_Desktop_Shortcut.vbs` - VBScript + +Simply double-click any of these files to create a shortcut on your desktop. See `SHORTCUT_CREATION_README.md` for detailed instructions. + +## Build Process + +The CI/CD workflows automatically: +1. Download and configure a minimal JRE using jlink +2. Build the EXE with Launch4j (embeds the JAR) +3. Create the installer with Inno Setup +4. Package a portable ZIP archive with all necessary files diff --git a/config/installer.iss b/config/installer.iss index 2a4704f..2d3bd4e 100644 --- a/config/installer.iss +++ b/config/installer.iss @@ -100,9 +100,19 @@ Source: "..\files\Getting_Started_with_Encryption_Wizard_4.0.005.txt"; DestDir: ; Fallback JAR launcher (for users who already have a JRE in PATH) Source: "..\files\Drop_Jar_File_Here_For_Fallback_Launch.bat"; DestDir: "{app}"; Flags: ignoreversion +; Direct launchers using bundled JRE +Source: "..\files\Launch_Encryption_Wizard.bat"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\files\Launch_Encryption_Wizard.ps1"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\files\Launch_Encryption_Wizard.vbs"; DestDir: "{app}"; Flags: ignoreversion + ; Homepage shortcut Source: "..\files\Encryption Wizard homepage.url"; DestDir: "{app}"; Flags: ignoreversion +; Desktop shortcut creation utilities +Source: "..\files\Create_Desktop_Shortcut.vbs"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\files\Create_Desktop_Shortcut.ps1"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\files\Create_Desktop_Shortcut.bat"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\files\SHORTCUT_CREATION_README.md"; DestDir: "{app}"; Flags: ignoreversion ; Application graphics (icon and splash image extracted from JAR) Source: "..\build\icon.ico"; DestDir: "{app}"; Flags: ignoreversion Source: "..\build\splash.png"; DestDir: "{app}"; Flags: ignoreversion diff --git a/files/Create_Desktop_Shortcut.bat b/files/Create_Desktop_Shortcut.bat new file mode 100644 index 0000000..b931e84 --- /dev/null +++ b/files/Create_Desktop_Shortcut.bat @@ -0,0 +1,65 @@ +@echo off +REM Batch file to create a Windows desktop shortcut for Encryption Wizard +REM This file uses PowerShell to create the shortcut since batch files cannot +REM directly create .lnk files. +REM +REM Usage: Double-click this file to create a desktop shortcut + +setlocal + +echo Creating Encryption Wizard desktop shortcut... +echo. + +REM Get the directory where this batch file is located +set "SCRIPT_DIR=%~dp0" + +REM Remove trailing backslash +if "%SCRIPT_DIR:~-1%"=="\" set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%" + +REM Use PowerShell to create the shortcut +powershell -ExecutionPolicy Bypass -NoProfile -Command ^ + "$scriptDir = '%SCRIPT_DIR%'; ^ + $jarFile = Join-Path $scriptDir 'EW-Unified-4.0.005-FIPS.jar'; ^ + $javaExe = Join-Path $scriptDir 'jre\bin\javaw.exe'; ^ + $exeFile = Join-Path $scriptDir 'EncryptionWizard.exe'; ^ + $workingDir = $scriptDir; ^ + $desktopPath = [Environment]::GetFolderPath('Desktop'); ^ + $shortcutPath = Join-Path $desktopPath 'Encryption Wizard.lnk'; ^ + $shell = New-Object -ComObject WScript.Shell; ^ + $shortcut = $shell.CreateShortcut($shortcutPath); ^ + if (Test-Path $exeFile) { ^ + $shortcut.TargetPath = $exeFile; ^ + $shortcut.IconLocation = \"$exeFile,0\"; ^ + $shortcut.Description = 'Encryption Wizard - FIPS-compliant encryption application'; ^ + Write-Host 'Using EncryptionWizard.exe launcher' -ForegroundColor Green; ^ + } elseif ((Test-Path $javaExe) -and (Test-Path $jarFile)) { ^ + $shortcut.TargetPath = $javaExe; ^ + $shortcut.Arguments = \"-jar `\"$jarFile`\"\"; ^ + $shortcut.Description = 'Encryption Wizard - FIPS-compliant encryption application'; ^ + $shortcut.IconLocation = \"$jarFile,0\"; ^ + Write-Host 'Using bundled JRE to launch JAR' -ForegroundColor Green; ^ + } else { ^ + Write-Host 'ERROR: Required files not found!' -ForegroundColor Red; ^ + Write-Host 'Expected either: EncryptionWizard.exe OR (jre\bin\javaw.exe + EW-Unified-4.0.005-FIPS.jar)'; ^ + exit 1; ^ + } ^ + $shortcut.WorkingDirectory = $workingDir; ^ + $shortcut.WindowStyle = 1; ^ + $shortcut.Save(); ^ + Write-Host ''; ^ + Write-Host 'Desktop shortcut created successfully!' -ForegroundColor Green; ^ + Write-Host \"Shortcut location: $shortcutPath\""" + +if %ERRORLEVEL% EQU 0 ( + echo. + echo Success! A shortcut has been created on your desktop. +) else ( + echo. + echo Failed to create shortcut. See error message above. +) + +echo. +echo Press any key to continue... +pause >nul + +endlocal diff --git a/files/Create_Desktop_Shortcut.ps1 b/files/Create_Desktop_Shortcut.ps1 new file mode 100644 index 0000000..2c074c1 --- /dev/null +++ b/files/Create_Desktop_Shortcut.ps1 @@ -0,0 +1,75 @@ +# PowerShell script to create a Windows desktop shortcut for Encryption Wizard +# This script creates a shortcut that uses the bundled JRE to launch the JAR file +# +# Usage: Right-click and select "Run with PowerShell" +# or from PowerShell: .\Create_Desktop_Shortcut.ps1 +# +# The script assumes it is located in the same directory as: +# - EW-Unified-4.0.005-FIPS.jar +# - jre\ subdirectory (containing the bundled Java Runtime) + +# Get the directory where this script is located +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path + +# Define paths +$jarFile = Join-Path $scriptDir "EW-Unified-4.0.005-FIPS.jar" +$javaExe = Join-Path $scriptDir "jre\bin\javaw.exe" +$exeFile = Join-Path $scriptDir "EncryptionWizard.exe" +$workingDir = $scriptDir + +# Get desktop path +$desktopPath = [Environment]::GetFolderPath("Desktop") +$shortcutPath = Join-Path $desktopPath "Encryption Wizard.lnk" + +# Create WScript Shell object for creating shortcuts +$shell = New-Object -ComObject WScript.Shell + +# Create the shortcut +$shortcut = $shell.CreateShortcut($shortcutPath) + +# Configure shortcut based on what files are available +if (Test-Path $exeFile) { + # If EncryptionWizard.exe exists, use it (it has embedded JAR and icon) + $shortcut.TargetPath = $exeFile + $shortcut.IconLocation = "$exeFile,0" + $shortcut.Description = "Encryption Wizard - FIPS-compliant encryption application" + Write-Host "Using EncryptionWizard.exe launcher" -ForegroundColor Green +} +elseif ((Test-Path $javaExe) -and (Test-Path $jarFile)) { + # Otherwise, use javaw.exe to launch the JAR directly + $shortcut.TargetPath = $javaExe + $shortcut.Arguments = "-jar `"$jarFile`"" + $shortcut.Description = "Encryption Wizard - FIPS-compliant encryption application" + # Try to use the JAR file itself as icon source (some JARs have embedded icons) + $shortcut.IconLocation = "$jarFile,0" + Write-Host "Using bundled JRE to launch JAR" -ForegroundColor Green +} +else { + Write-Host "ERROR: Required files not found!" -ForegroundColor Red + Write-Host "" + Write-Host "Expected either:" + Write-Host " - EncryptionWizard.exe" + Write-Host "OR" + Write-Host " - jre\bin\javaw.exe" + Write-Host " - EW-Unified-4.0.005-FIPS.jar" + Write-Host "" + Write-Host "in directory: $scriptDir" + exit 1 +} + +$shortcut.WorkingDirectory = $workingDir +$shortcut.WindowStyle = 1 # Normal window +$shortcut.Save() + +Write-Host "" +Write-Host "Desktop shortcut created successfully!" -ForegroundColor Green +Write-Host "Shortcut location: $shortcutPath" +Write-Host "" +if ($Host.UI.RawUI) { + Write-Host "Press any key to continue..." + try { + $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") + } catch { + Start-Sleep -Seconds 2 + } +} diff --git a/files/Create_Desktop_Shortcut.vbs b/files/Create_Desktop_Shortcut.vbs new file mode 100644 index 0000000..3c62409 --- /dev/null +++ b/files/Create_Desktop_Shortcut.vbs @@ -0,0 +1,73 @@ +' VBScript to create a Windows desktop shortcut for Encryption Wizard +' This script creates a shortcut that uses the bundled JRE to launch the JAR file +' +' Usage: Double-click this file or run: wscript Create_Desktop_Shortcut.vbs +' +' The script assumes it is located in the same directory as: +' - EW-Unified-4.0.005-FIPS.jar +' - jre\ subdirectory (containing the bundled Java Runtime) + +Option Explicit + +Dim objShell, objFSO, objShortcut +Dim strScriptDir, strDesktopPath, strShortcutPath +Dim strJavaExe, strJarFile, strWorkingDir, strIconFile + +' Create shell and file system objects +Set objShell = CreateObject("WScript.Shell") +Set objFSO = CreateObject("Scripting.FileSystemObject") + +' Get the directory where this script is located +strScriptDir = objFSO.GetParentFolderName(WScript.ScriptFullName) + +' Define paths +strJarFile = objFSO.BuildPath(strScriptDir, "EW-Unified-4.0.005-FIPS.jar") +strJavaExe = objFSO.BuildPath(strScriptDir, "jre\bin\javaw.exe") +strWorkingDir = strScriptDir + +' Check if EncryptionWizard.exe exists (from Launch4j build) +Dim strExeFile +strExeFile = objFSO.BuildPath(strScriptDir, "EncryptionWizard.exe") + +' Get desktop path +strDesktopPath = objShell.SpecialFolders("Desktop") +strShortcutPath = objFSO.BuildPath(strDesktopPath, "Encryption Wizard.lnk") + +' Create the shortcut +Set objShortcut = objShell.CreateShortcut(strShortcutPath) + +' If EncryptionWizard.exe exists, use it (it has embedded JAR and icon) +If objFSO.FileExists(strExeFile) Then + objShortcut.TargetPath = strExeFile + objShortcut.IconLocation = strExeFile & ",0" + objShortcut.Description = "Encryption Wizard - FIPS-compliant encryption application" +' Otherwise, use javaw.exe to launch the JAR directly +ElseIf objFSO.FileExists(strJavaExe) And objFSO.FileExists(strJarFile) Then + objShortcut.TargetPath = strJavaExe + objShortcut.Arguments = "-jar """ & strJarFile & """" + objShortcut.Description = "Encryption Wizard - FIPS-compliant encryption application" + ' Try to use the JAR file itself as icon source (some JARs have embedded icons) + objShortcut.IconLocation = strJarFile & ",0" +Else + WScript.Echo "ERROR: Required files not found!" & vbCrLf & vbCrLf & _ + "Expected either:" & vbCrLf & _ + " - EncryptionWizard.exe" & vbCrLf & _ + "OR" & vbCrLf & _ + " - jre\bin\javaw.exe" & vbCrLf & _ + " - EW-Unified-4.0.005-FIPS.jar" & vbCrLf & vbCrLf & _ + "in directory: " & strScriptDir + WScript.Quit 1 +End If + +objShortcut.WorkingDirectory = strWorkingDir +objShortcut.WindowStyle = 1 ' Normal window +objShortcut.Save + +' Success message +WScript.Echo "Desktop shortcut created successfully!" & vbCrLf & vbCrLf & _ + "Shortcut location: " & strShortcutPath + +' Cleanup +Set objShortcut = Nothing +Set objFSO = Nothing +Set objShell = Nothing diff --git a/files/Launch_Encryption_Wizard.bat b/files/Launch_Encryption_Wizard.bat new file mode 100644 index 0000000..7b7ba73 --- /dev/null +++ b/files/Launch_Encryption_Wizard.bat @@ -0,0 +1,63 @@ +@echo off +REM Launcher for Encryption Wizard using the bundled JRE +REM This script launches the Encryption Wizard JAR file using the local JRE +REM located in the jre/ subdirectory. +REM +REM Usage: Double-click this file or run from command line with optional arguments +REM Launch_Encryption_Wizard.bat [arguments for Encryption Wizard] +REM +REM This script expects to find: +REM - jre\bin\java.exe (bundled Java Runtime) +REM - EW-Unified-4.0.005-FIPS.jar (the application JAR) + +setlocal enableextensions + +REM Get the directory where this script is located +set "SCRIPT_DIR=%~dp0" + +REM Remove trailing backslash +if "%SCRIPT_DIR:~-1%"=="\" set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%" + +REM Define paths +set "JAVA_EXE=%SCRIPT_DIR%\jre\bin\java.exe" +set "JAR_FILE=%SCRIPT_DIR%\EW-Unified-4.0.005-FIPS.jar" + +REM Check if the bundled JRE exists +if not exist "%JAVA_EXE%" ( + echo ERROR: Bundled JRE not found! + echo Expected location: %JAVA_EXE% + echo. + echo Please ensure the jre directory is in the same location as this script. + echo. + pause + exit /b 1 +) + +REM Check if the JAR file exists +if not exist "%JAR_FILE%" ( + echo ERROR: Encryption Wizard JAR file not found! + echo Expected location: %JAR_FILE% + echo. + echo Please ensure EW-Unified-4.0.005-FIPS.jar is in the same location as this script. + echo. + pause + exit /b 1 +) + +REM Launch the application with the bundled JRE +REM Pass all command line arguments to the application +"%JAVA_EXE%" -jar "%JAR_FILE%" %* + +REM Capture the exit code +set EXITCODE=%ERRORLEVEL% + +REM Pause only if there was an error (non-zero exit code) +if %EXITCODE% neq 0 ( + echo. + echo Encryption Wizard exited with code: %EXITCODE% + echo. + pause +) + +endlocal +exit /b %EXITCODE% diff --git a/files/Launch_Encryption_Wizard.ps1 b/files/Launch_Encryption_Wizard.ps1 new file mode 100644 index 0000000..9c145aa --- /dev/null +++ b/files/Launch_Encryption_Wizard.ps1 @@ -0,0 +1,79 @@ +# PowerShell launcher for Encryption Wizard using the bundled JRE +# This script launches the Encryption Wizard JAR file using the local JRE +# located in the jre/ subdirectory. +# +# Usage: Right-click and select "Run with PowerShell" +# or from PowerShell: .\Launch_Encryption_Wizard.ps1 [arguments] +# +# This script expects to find: +# - jre\bin\java.exe (bundled Java Runtime) +# - EW-Unified-4.0.005-FIPS.jar (the application JAR) + +# Get the directory where this script is located +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path + +# Define paths +$javaExe = Join-Path $scriptDir "jre\bin\java.exe" +$jarFile = Join-Path $scriptDir "EW-Unified-4.0.005-FIPS.jar" + +# Check if the bundled JRE exists +if (-not (Test-Path $javaExe)) { + Write-Host "ERROR: Bundled JRE not found!" -ForegroundColor Red + Write-Host "Expected location: $javaExe" + Write-Host "" + Write-Host "Please ensure the jre directory is in the same location as this script." + Write-Host "" + if ($Host.UI.RawUI) { + Write-Host "Press any key to continue..." + try { + $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") + } catch { + Start-Sleep -Seconds 3 + } + } + exit 1 +} + +# Check if the JAR file exists +if (-not (Test-Path $jarFile)) { + Write-Host "ERROR: Encryption Wizard JAR file not found!" -ForegroundColor Red + Write-Host "Expected location: $jarFile" + Write-Host "" + Write-Host "Please ensure EW-Unified-4.0.005-FIPS.jar is in the same location as this script." + Write-Host "" + if ($Host.UI.RawUI) { + Write-Host "Press any key to continue..." + try { + $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") + } catch { + Start-Sleep -Seconds 3 + } + } + exit 1 +} + +# Launch the application with the bundled JRE +# Pass all command line arguments to the application +Write-Host "Launching Encryption Wizard..." -ForegroundColor Green +Write-Host "" + +$arguments = @("-jar", $jarFile) + $args +$process = Start-Process -FilePath $javaExe -ArgumentList $arguments -Wait -NoNewWindow -PassThru + +# Check exit code +if ($process.ExitCode -ne 0) { + Write-Host "" + Write-Host "Encryption Wizard exited with code: $($process.ExitCode)" -ForegroundColor Yellow + Write-Host "" + if ($Host.UI.RawUI) { + Write-Host "Press any key to continue..." + try { + $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") + } catch { + Start-Sleep -Seconds 3 + } + } + exit $process.ExitCode +} + +exit 0 diff --git a/files/Launch_Encryption_Wizard.vbs b/files/Launch_Encryption_Wizard.vbs new file mode 100644 index 0000000..44f61dc --- /dev/null +++ b/files/Launch_Encryption_Wizard.vbs @@ -0,0 +1,58 @@ +' VBScript launcher for Encryption Wizard using the bundled JRE +' This script launches the Encryption Wizard JAR file using the local JRE +' located in the jre/ subdirectory. +' +' Usage: Double-click this file or run: wscript Launch_Encryption_Wizard.vbs +' +' This script expects to find: +' - jre\bin\javaw.exe (bundled Java Runtime - GUI mode) +' - EW-Unified-4.0.005-FIPS.jar (the application JAR) + +Option Explicit + +Dim objShell, objFSO +Dim strScriptDir, strJavaExe, strJarFile +Dim intResult + +' Create shell and file system objects +Set objShell = CreateObject("WScript.Shell") +Set objFSO = CreateObject("Scripting.FileSystemObject") + +' Get the directory where this script is located +strScriptDir = objFSO.GetParentFolderName(WScript.ScriptFullName) + +' Define paths - use javaw.exe for GUI mode (no console window) +strJavaExe = objFSO.BuildPath(strScriptDir, "jre\bin\javaw.exe") +strJarFile = objFSO.BuildPath(strScriptDir, "EW-Unified-4.0.005-FIPS.jar") + +' Check if the bundled JRE exists +If Not objFSO.FileExists(strJavaExe) Then + WScript.Echo "ERROR: Bundled JRE not found!" & vbCrLf & vbCrLf & _ + "Expected location: " & strJavaExe & vbCrLf & vbCrLf & _ + "Please ensure the jre directory is in the same location as this script." + WScript.Quit 1 +End If + +' Check if the JAR file exists +If Not objFSO.FileExists(strJarFile) Then + WScript.Echo "ERROR: Encryption Wizard JAR file not found!" & vbCrLf & vbCrLf & _ + "Expected location: " & strJarFile & vbCrLf & vbCrLf & _ + "Please ensure EW-Unified-4.0.005-FIPS.jar is in the same location as this script." + WScript.Quit 1 +End If + +' Launch the application with the bundled JRE +' Use javaw.exe which doesn't show a console window +' Use Run method with wait parameter to wait for completion +intResult = objShell.Run("""" & strJavaExe & """ -jar """ & strJarFile & """", 1, True) + +' Check exit code +If intResult <> 0 Then + WScript.Echo "Encryption Wizard exited with code: " & intResult +End If + +' Cleanup +Set objFSO = Nothing +Set objShell = Nothing + +WScript.Quit intResult diff --git a/files/SHORTCUT_CREATION_README.md b/files/SHORTCUT_CREATION_README.md new file mode 100644 index 0000000..1f4e878 --- /dev/null +++ b/files/SHORTCUT_CREATION_README.md @@ -0,0 +1,68 @@ +# Creating a Desktop Shortcut for Encryption Wizard + +This directory contains several utilities to create a Windows desktop shortcut for Encryption Wizard that uses the bundled JRE to launch the application. + +## Quick Start + +Simply double-click one of these files to create a desktop shortcut: + +- **Create_Desktop_Shortcut.bat** (Recommended - works on all Windows systems) +- **Create_Desktop_Shortcut.vbs** (Alternative method using VBScript) +- **Create_Desktop_Shortcut.ps1** (PowerShell script - may require execution policy changes) + +## What the Scripts Do + +All three scripts perform the same function: +1. Detect if `EncryptionWizard.exe` exists (created by Launch4j build) +2. If the EXE exists, create a shortcut pointing to it (uses embedded JAR and icon) +3. If the EXE doesn't exist, create a shortcut that uses the bundled JRE to launch the JAR directly +4. Place the shortcut on your Windows desktop + +## Icon Support + +The shortcuts will attempt to use icons in the following order: +1. **EncryptionWizard.exe** - If the Launch4j-built executable exists, its embedded icon will be used +2. **JAR file** - Some JAR files have embedded icons that Windows can extract +3. **Default Java icon** - If no icon is available, Windows will use the default Java application icon + +## Files Required + +The scripts expect to find these files in the same directory: +- `EW-Unified-4.0.005-FIPS.jar` - The Encryption Wizard application +- `jre/bin/javaw.exe` - The bundled Java Runtime Environment +- `EncryptionWizard.exe` - (Optional) The Launch4j-built executable with embedded JAR + +## Troubleshooting + +### PowerShell Execution Policy +If you receive an error about execution policy when running the `.ps1` file: +1. Right-click the PowerShell script and select "Run with PowerShell" +2. Or use the `.bat` file instead, which bypasses this issue +3. Or run this command in PowerShell as Administrator: + ```powershell + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + ``` + +### Missing Files +If you get an error about missing files: +- Ensure you're running the script from the correct directory (where the JAR and JRE are located) +- Check that the `jre` subdirectory exists with the bundled Java Runtime +- Verify that `EW-Unified-4.0.005-FIPS.jar` is present + +## Manual Shortcut Creation + +If the automated scripts don't work, you can create a shortcut manually: + +1. Right-click on your desktop and select "New" → "Shortcut" +2. For the location, enter one of: + - Path to `EncryptionWizard.exe` (if available) + - OR: `"C:\path\to\jre\bin\javaw.exe" -jar "C:\path\to\EW-Unified-4.0.005-FIPS.jar"` +3. Name it "Encryption Wizard" +4. Right-click the shortcut → Properties → Change Icon +5. Browse to `EncryptionWizard.exe` or the JAR file to extract the icon + +## Additional Information + +For more information about Encryption Wizard, see: +- `Getting_Started_with_Encryption_Wizard_4.0.005.txt` - Quick start guide +- `Encryption Wizard User Guide v405.pdf` - Complete user documentation