Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 18, 2023 01:46
Show Gist options
  • Save parzibyte/a75dbbd1fe803f420bd1eae4ef9dbc6d to your computer and use it in GitHub Desktop.
Save parzibyte/a75dbbd1fe803f420bd1eae4ef9dbc6d to your computer and use it in GitHub Desktop.
; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Sistema gratuito para restaurantes By Parzibyte"
!define URL_PROGRAMA "http://localhost:5000/public/#/usuarios/login"
!define NOMBRE_EJECUTABLE_PROGRAMA "Sistema gratuito para restaurantes by parzibyte.exe"
!define NOMBRE_EJECUTABLE_DETENER "detener.exe"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "Parzibyte"
!define PRODUCT_WEB_SITE "https://parzibyte.me/blog"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${NOMBRE_EJECUTABLE_PROGRAMA}"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION funcionAlTerminar
!insertmacro MUI_PAGE_FINISH
Function funcionAlTerminar
Exec "$INSTDIR\${NOMBRE_EJECUTABLE_PROGRAMA}"
ExecShell "open" "${URL_PROGRAMA}"
FunctionEnd
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "Spanish"
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Sistema para restaurantes By Parzibyte (Instalador).exe"
InstallDir "$APPDATA\${PRODUCT_NAME}"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Section "Principal" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File ".\api\${NOMBRE_EJECUTABLE_PROGRAMA}"
File ".\detener\${NOMBRE_EJECUTABLE_DETENER}"
SetOutPath "$INSTDIR\dist"
File /r ".\dist\"
SetOutPath "$INSTDIR"
CreateShortCut "$APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\${PRODUCT_NAME}.lnk" "$INSTDIR\${NOMBRE_EJECUTABLE_PROGRAMA}"
CreateShortCut "$DESKTOP\Desinstalar ${PRODUCT_NAME}.lnk" "$INSTDIR\uninst.exe"
WriteIniStr "$DESKTOP\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${URL_PROGRAMA}"
SectionEnd
Section -AdditionalIcons
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\EjecutablePrincipal.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\EjecutablePrincipal.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "La desinstalaci�n de $(^Name) finaliz� satisfactoriamente."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "�Est� completamente seguro que desea desinstalar $(^Name) junto con todos sus componentes?" IDYES +2
Abort
FunctionEnd
Section Uninstall
DetailPrint "Deteniendo servidor..."
DetailPrint "$INSTDIR\${NOMBRE_EJECUTABLE_DETENER}"
Exec "$INSTDIR\${NOMBRE_EJECUTABLE_DETENER}"
Sleep 5000
DetailPrint "Detenido"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\${NOMBRE_EJECUTABLE_PROGRAMA}"
Delete "$INSTDIR\${NOMBRE_EJECUTABLE_DETENER}"
Delete "$INSTDIR\*.db"
Delete "$INSTDIR\*.log"
RMDir /r "$INSTDIR\dist"
RMDir /r "$INSTDIR\fotos_platillos"
Delete "$SMPROGRAMS\Sistema para restaurantes By Parzibyte\Uninstall.lnk"
Delete "$DESKTOP\${PRODUCT_NAME}.url"
DELETE "$DESKTOP\Desinstalar ${PRODUCT_NAME}.lnk"
Delete "$SMPROGRAMS\Sistema para restaurantes By Parzibyte\Sistema para restaurantes By Parzibyte.lnk"
Delete "$APPDATA\Microsoft\Windows\Start Menu\Programs\Startup\${PRODUCT_NAME}.lnk"
RMDir "$SMPROGRAMS\Sistema para restaurantes By Parzibyte"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment