AppGen.nsi 1.9 KB

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