; Código del nuevo instalador profesional I ; Hecho por Joel Almeida García --> Lobo Lunar ;Declaración de las propiedas internas SetCompressor "bzip2" VIProductVersion "1.0.0.0" VIAddVersionKey /lang=2058 "ProductName" "Herramientas de Matemáticas 4" VIAddVersionKey "Comments" "Programa de instalación hecho por NSIS con NSIS Workbench" VIAddVersionKey "CompanyName" "Lobo Lunar" VIAddVersionKey "LegalTrademarks" "http://lobolunar.ajstone.org/" VIAddVersionKey "LegalCopyright" "© Lobo Lunar" VIAddVersionKey "FileDescription" "Herramientas de Matemáticas 4" VIAddVersionKey "FileVersion" "4.0.0" !define Autor "Lobo Lunar" !define ResDir "C:\joelito\utilidades\dev\NSIS\NsisRes" !define ResFiles "C:\joelito\utilidades\exe" !define url "http://lobolunar.ajstone.org" !define url1 "http://download.microsoft.com/download/vb60pro/Redist/sp5/WIN98Me/EN-US/VBRun60sp5.exe" !define url2 "${url}/dll/COMCTL32.exe" !define IOFile "io.ini" !define pc "pc.ini" !define main "HM4" !define IE "5" !define TVM_SetCtlColors 0x111D !define TVM_SETTEXTCOLOR 0x111E !define LVM_SetCtlColors 0x1001 ;Declaración de los colores !define BGcolor "000000" ;Color del fondo de TOP !define FGcolor "FFFFFF" ;Color de las letras de TOP !define BG_color1 "B0ACB0" ;Color del fondo en HTML(General) !define FG_color1 "595559" ;Color de las letras en HTML(General) !define BG_color2 "0x00B0ACB0" ;Color del fondo en HEX (General) !define FG_color2 "0x00595559" ;Color de las letras en HEX (General) !include "MUI.nsh" !define MUI_BGCOLOR "${BG_color1}" !define MUI_PRODUCT "HM" !define MUI_VERSION "4" !define MUI_PAGE_CUSTOMFUNCTION_SHOW "MUIDlgColor" !insertmacro MUI_PAGE_WELCOME !define MUI_LICENSEPAGE_CHECKBOX !define MUI_PAGE_CUSTOMFUNCTION_SHOW "TopColor" !insertmacro MUI_PAGE_LICENSE "${ResDir}\licesp.rtf" !define MUI_PAGE_CUSTOMFUNCTION_SHOW "DirColor" !insertmacro MUI_PAGE_DIRECTORY !define MUI_PAGE_CUSTOMFUNCTION_PRE "Runtime" !define MUI_PAGE_CUSTOMFUNCTION_SHOW "CompColor" !insertmacro MUI_PAGE_COMPONENTS Page custom Task "" "" !insertmacro MUI_PAGE_INSTFILES !define MUI_PAGE_CUSTOMFUNCTION_SHOW "MUIDlgColor" !insertmacro MUI_PAGE_FINISH !define MUI_PAGE_CUSTOMFUNCTION_SHOW "un.TopColor" !insertmacro MUI_UNPAGE_INSTFILES !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_FINISHPAGE_RUN "$INSTDIR\${main}.exe" !define MUI_FINISHPAGE_RUN_NOTCHECKED !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED !define MUI_ICON "${ResDir}\1f.ico" !define MUI_UNICON "${ResDir}\2c.ico" !define MUI_UI "${NSISDIR}\Contrib\UIs\modern.exe" !define MUI_COMPONENTSPAGE_SMALLDESC !define MUI_HEADERBITMAP_RIGHT !define MUI_HEADERBITMAP "${ResDir}\top2.bmp" !define MUI_INSTALLCOLORS "${FG_color1} ${BG_color1}" !define MUI_PROGRESSBAR "smooth colored" !define MUI_SPECIALINI "${NSISDIR}\Contrib\Modern UI\ioSpecial.ini" !define MUI_CHECKBITMAP "${ResDir}\check1.bmp" !define MUI_SPECIALBITMAP "${ResDir}\nsis2.bmp" ReserveFile "${ResDir}\${IOFile}" ReserveFile "${ResDir}\${pc}" !insertmacro MUI_RESERVEFILE_WELCOMEFINISHPAGE !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS !insertmacro MUI_LANGUAGE "Spanish" !define MUI_FONT "Verdana" !define MUI_FONTSIZE "8" !define MUI_FONT_HEADER "Verdana" !define MUI_FONTSIZE_HEADER "9" !define MUI_FONTSTYLE_HEADER "900" XPStyle "on" SetDateSave on ShowInstDetails show ShowUninstDetails show ;!packhdr "temp.dat" "${ResDir}\upx.exe -9 temp.dat" OutFile "inst-${main}.exe" InstallDir "$PROGRAMFILES\${MUI_PRODUCT}${MUI_VERSION}" InstallDirRegKey HKLM "SOFTWARE\Lobo_Lunar" "${MUI_PRODUCT} ${MUI_VERSION}" LicenseBKColor "${BG_color1}" BrandingText "${Autor}" ;Declaración de macros !macro descargar FileDude URL NSISdl::download /TRANSLATE "Descargando %s" "Conectando" "segundo" "minuto" "hora" "s" "%d KB (%d%%) de %d KB a %d.%01d KB/s" " (%d %s%s restantes)" ${URL} "$TEMP\${FileDude}" Pop $0 StrCmp $0 "success" +3 0 DetailPrint "Error al descargar ${FileDude}" Goto +3 ExecWait "$TEMP\${FileDude}" Delete "$TEMP\${FileDude}" !macroend Function ".onInit" Banner::show /NOUNLOAD "Detectando componentes instalados..." " " File /oname=$PLUGINSDIR\1c.ico "${ResDir}\1c.ico" File /oname=$PLUGINSDIR\ico1.ico "${ResDir}\ico1.ico" File /oname=$PLUGINSDIR\ico2.ico "${ResDir}\ico2.ico" File /oname=$PLUGINSDIR\ico3.ico "${ResDir}\ico3.ico" File /oname=$PLUGINSDIR\ico4.ico "${ResDir}\ico4.ico" File /oname=$PLUGINSDIR\ico5.ico "${ResDir}\ico5.ico" File /oname=$PLUGINSDIR\ico6.ico "${ResDir}\ico6.ico" File /oname=$PLUGINSDIR\ico7.ico "${ResDir}\ico7.ico" File /oname=$PLUGINSDIR\4.ico "${ResDir}\4.ico" !insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "${ResDir}\${IOFile}" "${IOFile}" !insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "${ResDir}\${pc}" "${pc}" WriteIniStr $PLUGINSDIR\${IOFile} "Field 7" Text $PLUGINSDIR\1c.ico WriteIniStr $PLUGINSDIR\${IOFile} "Field 8" Text $PLUGINSDIR\ico1.ico WriteIniStr $PLUGINSDIR\${IOFile} "Field 9" Text $PLUGINSDIR\ico5.ico WriteIniStr $PLUGINSDIR\${IOFile} "Field 10" Text $PLUGINSDIR\ico3.ico WriteIniStr $PLUGINSDIR\${IOFile} "Field 11" Text $PLUGINSDIR\ico2.ico Call "IEver" Call "TransSTr" Banner::destroy FunctionEnd Function "un.onInit" MessageBox MB_YESNO|MB_ICONQUESTION "¿Deseas desinstalar ${MUI_PRODUCT} ${MUI_VERSION}?" IDYES NoAbort Abort ; causes uninstaller to quit. NoAbort: FunctionEnd ;Declaración de las secciones de nuestro instalador Section "-${MUI_PRODUCT}" SetOutPath $INSTDIR File /r "${ResFiles}\*.*" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT} ${MUI_VERSION}" "DisplayName" "Desinstalar ${MUI_PRODUCT} ${MUI_VERSION}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT} ${MUI_VERSION}" "UninstallString" "$INSTDIR\des-${main}.exe" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT} ${MUI_VERSION}" "DisplayIcon" "$INSTDIR\des-${main}.exe,0" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT} ${MUI_VERSION}" "Publisher" "${Autor}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT} ${MUI_VERSION}" "Comments" "Instalador hecho con Nsis" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT} ${MUI_VERSION}" "URLInfoAbout" "${url}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT} ${MUI_VERSION}" "HelpLink" "$INSTDIR\ayuda.chm" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT} ${MUI_VERSION}" "DisplayVersion" "${MUI_VERSION}" Call "sms" Call "desk" Call "ql" Call "reg" WriteUninstaller "$INSTDIR\des-${main}.exe" SetAutoClose "false" SectionEnd SubSection "${MUI_PRODUCT}" opt1 Section "VB6 Runtime" op1 AddSize 1014 !insertmacro descargar "VBRun60sp5.exe" ${url1} SectionEnd Section "ComCtl32" op2 AddSize 510 !insertmacro descargar "comctlzp.exe" ${url2} SectionEnd SubSectionEnd ;Declaración de la sección del desinstalador Section "Uninstall" DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MUI_PRODUCT} ${MUI_VERSION}" RMDir $INSTDIR SetShellVarContext "all" Delete "$DESKTOP\${MUI_PRODUCT} ${MUI_VERSION}.lnk" RMDir /r "$SMPROGRAMS\${MUI_PRODUCT} ${MUI_VERSION}" Delete "$QUICKLAUNCH\${MUI_PRODUCT} ${MUI_VERSION}.lnk" SectionEnd !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${opt1} "Componentes para ${MUI_PRODUCT}" !insertmacro MUI_DESCRIPTION_TEXT ${op1} "Descargar Visual Basic 6 Runtime desde de Internet." !insertmacro MUI_DESCRIPTION_TEXT ${op2} "Descargar Comctl32.ocx desde de Internet." !insertmacro MUI_FUNCTION_DESCRIPTION_END ;Funciones del Instalador Function "TransSTr" StrCpy $0 "Tareas Adicionales" StrCpy $1 "En el Menú Inicio" StrCpy $2 "En el Escritorio" StrCpy $3 "En Quicklaunch (Requiere Win98 o superior)" StrCpy $4 "En el Registro de Windows (Futuras actulizaciones)" WriteIniStr $PLUGINSDIR\io.ini "Field 1" Text $0 WriteIniStr $PLUGINSDIR\io.ini "Field 2" Text $1 WriteIniStr $PLUGINSDIR\io.ini "Field 3" Text $2 WriteIniStr $PLUGINSDIR\io.ini "Field 4" Text $3 WriteIniStr $PLUGINSDIR\io.ini "Field 5" Text $4 FunctionEnd Function "IEver" GetDllVersion "$SYSDIR\shdocvw.dll" $R0 $R1 IntOp $R2 $R0 / 0x00010000 IntOp $R3 $R0 & 0x0000FFFF IntOp $R4 $R1 / 0x00010000 IntOp $R5 $R1 & 0x0000FFFF ;StrCpy $0 "$R2.$R3.$R4.$R5" IntCmp $R2 ${IE} +2 +1 +2 MessageBox MB_OK|MB_ICONSTOP "Tienes una versión $R2.x de Internet Explorer. $\r$\nSe requiere una versión ${IE}.x o superior $\r$\npara visualizar correctamente ${MUI_PRODUCT}." FunctionEnd Function "Task" !insertmacro MUI_HEADER_TEXT "Tareas adicionales para ${MUI_PRODUCT} ${MUI_VERSION}" "Elije accesos directos para ${MUI_PRODUCT}. Al terminar inicia la instalación." Push $R0 !insertmacro MUI_INSTALLOPTIONS_INITDIALOG "${IOFile}" Pop $R0 !insertmacro MUI_INSTALLOPTIONS_SHOW FunctionEnd Function "Runtime" IfFileExists $SYSDIR\msvbvm601.dll +1 +4 WriteIniStr $PLUGINSDIR\${pc} "PC" "VB6" "1" SectionSetFlags ${op1} 16 Goto +2 WriteIniStr $PLUGINSDIR\${pc} "PC" "VB6" "0" IfFileExists $SYSDIR\comctl32.ocx +1 +4 WriteIniStr $PLUGINSDIR\${pc} "PC" "COMCTL" "1" SectionSetFlags ${op2} 16 Goto +2 WriteIniStr $PLUGINSDIR\${pc} "PC" "COMCTL" "0" ReadINIStr $0 $PLUGINSDIR\${pc} "PC" "VB6" ReadINIStr $1 $PLUGINSDIR\${pc} "PC" "COMCTL" IntOp $2 $0 + $1 IntCmp $2 "2" +1 +2 +2 Abort FunctionEnd Function "sms" ReadINIStr $0 $PLUGINSDIR\${IOFile} "Field 2" State StrCmp $0 "1" +1 +6 SetShellVarContext "all" CreateDirectory "$SMPROGRAMS\${MUI_PRODUCT} ${MUI_VERSION}" CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT} ${MUI_VERSION}\${MUI_PRODUCT} ${MUI_VERSION}.lnk" "$INSTDIR\${main}.exe" "" "$INSTDIR\${main}.exe" 0 "SW_SHOWNORMAL" "" "Ejecutar ${MUI_PRODUCT}" CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT} ${MUI_VERSION}\Ayuda.lnk" "$INSTDIR\ayuda.chm" "" "$INSTDIR\ayuda.chm" 0 "SW_SHOWNORMAL" "" "Abrir Archivo de ayuda" CreateShortCut "$SMPROGRAMS\${MUI_PRODUCT} ${MUI_VERSION}\Desinstalar.lnk" "$INSTDIR\des-${main}.exe" "" "$INSTDIR\des-${main}.exe" 0 "SW_SHOWNORMAL" "" "Desinstalar ${MUI_PRODUCT}" FunctionEnd Function "desk" ReadINIStr $1 $PLUGINSDIR\${IOFile} "Field 3" State StrCmp $1 "1" +1 +3 SetShellVarContext "all" CreateShortCut "$DESKTOP\${MUI_PRODUCT} ${MUI_VERSION}.lnk" "$INSTDIR\${main}.exe" "" "$INSTDIR\${main}.exe" 0 "SW_SHOWNORMAL" "" "Ejecutar ${MUI_PRODUCT}" FunctionEnd Function "ql" StrCmp $QUICKLAUNCH $TEMP +5 +1 ReadINIStr $2 $PLUGINSDIR\${IOFile} "Field 4" State StrCmp $2 "1" +1 +3 SetShellVarContext "all" CreateShortCut "$QUICKLAUNCH\${MUI_PRODUCT} ${MUI_VERSION}.lnk" "$INSTDIR\${main}.exe" "" "$INSTDIR\${main}.exe" 0 "SW_SHOWNORMAL" "" "Ejecutar ${MUI_PRODUCT}" FunctionEnd Function "reg" ReadIniStr $3 $PLUGINSDIR\${IOFile} "Field 5" State StrCmp $3 "1" +1 +2 WriteRegStr HKLM "SOFTWARE\Lobo_Lunar" "${MUI_PRODUCT} ${MUI_VERSION}" "$INSTDIR" FunctionEnd Function "CompColor" FindWindow $0 "#32770" "" $HWNDPARENT GetDlgItem $0 $0 1032 SendMessage $0 ${TVM_SetCtlColors} 0 ${BG_color2} SendMessage $0 ${TVM_SETTEXTCOLOR} 0 ${FG_color2} CreateFont $1 "Comic Sans Ms" "8" "500" SendMessage $0 ${WM_SETFONT} $1 0 FunctionEnd Function "DirColor" FindWindow $0 "#32770" "" $HWNDPARENT GetDlgItem $0 $0 1019 SetCtlColors $0 ${FGcolor} ${BGcolor} FunctionEnd Function "MUIDlgColor" GetDlgItem $0 $MUI_HWND 1201 GetDlgItem $1 $MUI_HWND 1202 SetCtlColors $0 ${FG_color1} ${BG_color1} SetCtlColors $1 ${FG_color1} ${BG_color1} FunctionEnd Function "TopColor" GetDlgItem $0 $HWNDPARENT 1037 GetDlgItem $1 $HWNDPARENT 1038 GetDlgItem $2 $HWNDPARENT 1034 SetCtlColors $2 ${FGcolor} ${BGcolor} SetCtlColors $0 ${FGcolor} ${BGcolor} SetCtlColors $1 ${FGcolor} ${BGcolor} FunctionEnd Function "un.TopColor" GetDlgItem $0 $HWNDPARENT 1037 GetDlgItem $1 $HWNDPARENT 1038 GetDlgItem $2 $HWNDPARENT 1034 SetCtlColors $2 ${FGcolor} ${BGcolor} SetCtlColors $0 ${FGcolor} ${BGcolor} SetCtlColors $1 ${FGcolor} ${BGcolor} FunctionEnd