-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller.nsi
More file actions
77 lines (58 loc) · 2.21 KB
/
Copy pathinstaller.nsi
File metadata and controls
77 lines (58 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
RequestExecutionLevel admin
!include "MUI2.nsh"
!include "FileFunc.nsh"
!include LogicLib.nsh
SetCompressor /FINAL /SOLID lzma
# Define application information
!define APPNAME "OCR Tool"
!define PUBLISHER "Your Company Name"
!define VERSION "1.0.0"
Name "${APPNAME}"
OutFile "OCR_Tool_Setup.exe"
InstallDir "$PROGRAMFILES64\${APPNAME}"
!define MUI_ICON "icons\icon.ico"
!define MUI_UNICON "icons\icon.ico"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Section "MainSection" SEC01
SetShellVarContext all
SetOutPath "$INSTDIR"
# Create temp directory in AppData
CreateDirectory "$LOCALAPPDATA\OCR_Tool\temp"
AccessControl::GrantOnFile "$LOCALAPPDATA\OCR_Tool" "(S-1-1-0)" "FullAccess"
# Copy main executable
File "dist\OCR_Tool.exe"
# Create shortcuts
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\OCR_Tool.exe"
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\OCR_Tool.exe"
# Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
# Register application
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
"DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" \
"UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OCR Tool" \
"DisplayIcon" "$INSTDIR\OCR_Tool.exe"
SectionEnd
Section "Uninstall"
SetShellVarContext all
# Remove application files
Delete "$INSTDIR\OCR_Tool.exe"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
# Remove temp directory
RMDir /r "$LOCALAPPDATA\OCR_Tool"
# Remove shortcuts
Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk"
Delete "$DESKTOP\${APPNAME}.lnk"
RMDir "$SMPROGRAMS\${APPNAME}"
# Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
SectionEnd