Debian Codegraph @

Examples/AppGen.nsi

raw
1 /*
2 Note: This is not a installer example script, it's a script for a simple application used by some of the other examples.
3 */
4
5 !define /math ARCBITS ${NSIS_PTR_SIZE} * 8
6 Name "${NAME}"
7 !define /IfNDef OUTFILE ""
8 OutFile "${OUTFILE}"
9 Unicode True
10 !define /IfNDef REL User
11 RequestExecutionLevel ${REL}
12 XPStyle On
13 ManifestDPIAware True
14 AutoCloseWindow True
15 BrandingText " "
16 Caption "$(^Name) (${ARCBITS}-bit)"
17 MiscButtonText " " " " "E&xit" " "
18 LicenseBkColor /windows
19
20 !ifdef COMPANY
21 !ifndef NOPEVI
22 !define /IfNDef VER 1.2.3.4
23 VIProductVersion ${VER}
24 VIAddVersionKey /LANG=0 "FileVersion" "${VER}"
25 VIAddVersionKey /LANG=0 "CompanyName" "${COMPANY}"
26 VIAddVersionKey /LANG=0 "LegalCopyright" "${U+00A9} ${COMPANY}"
27 VIAddVersionKey /LANG=0 "FileDescription" "${NAME}"
28 !endif
29 !endif
30
31 !include WinMessages.nsh
32 !include LogicLib.nsh
33
34 PageEx License
35 Caption " "
36 LicenseText "$ExeFile$\n$ExePath" "E&xit"
37 PageCallbacks "" OnShow
38 PageExEnd
39 Page InstFiles
40
41
42 Function .onInit
43 !ifdef AUMI
44 System::Call 'SHELL32::SetCurrentProcessExplicitAppUserModelID(ws)' "${AUMI}"
45 !endif
46 FunctionEnd
47
48
49 Function OnShow
50 FindWindow $0 "#32770" "" $hWndParent
51 GetDlgItem $R9 $0 0x3E8
52
53 !ifdef MSG
54 SendMessage $R9 ${EM_REPLACESEL} "" "STR:${MSG}$\r$\n$\r$\n"
55 !endif
56
57 !ifdef TMPLDATA
58 ${IfNot} ${FileExists} "$AppData\${NAME}\*"
59 ; Copy template data from the shared source to this users profile
60 CreateDirectory "$AppData\${NAME}"
61 CopyFiles /Silent "${TMPLDATA}\*" "$AppData\${NAME}"
62 ${EndIf}
63 ReadIniStr $2 "$AppData\${NAME}\Data.ini" Example Count
64 IntOp $2 $2 + 1
65 WriteIniStr "$AppData\${NAME}\Data.ini" Example Count $2
66 SendMessage $R9 ${EM_REPLACESEL} "" "STR:Launch Count=$2$\r$\n$\r$\n"
67 !endif
68
69 SendMessage $R9 ${EM_REPLACESEL} "" "STR:CmdLine=$CmdLine$\r$\n"
70 ReadEnvStr $2 "USERNAME"
71 SendMessage $R9 ${EM_REPLACESEL} "" "STR:%USERNAME%=$2$\r$\n"
72 ReadEnvStr $2 "__COMPAT_LAYER"
73 StrCmp $2 "" +2
74 SendMessage $R9 ${EM_REPLACESEL} "" "STR:Compatibility=$2$\r$\n"
75 FunctionEnd
76
77 Section
78 SectionEnd