Geckozone

Liberté d'extension

Aller au contenu

Icône KMES KMES 2.10 Main Setup Script Source Return to Files List

  For a more comfortable reading, hide the left toolbar.

! Warning : Due to wiki syntax, double " (empty strings) have been replaced by '' in this page.

! Warning : Due to wiki syntax, I have add an underscore in this word : r_eadfile.

<<< Previous page           Next page >>>

 

;language section

!ifdef _Localize
     SubSection /e "Locales" SecLocalize

          !ifdef _Language_Add
               Section ${PRODUCT_FOLDER} SecLanguage
                    SectionIn RO

                    ; Copying files
                    SetOutPath "$INSTDIR\locales\${PRODUCT_FOLDER}"
                    File /r .\locales\language\*.*

                    ; if uninstaller hasn't yet been created or updated, create it
                    StrCmp $_unSetup 1 un_SecLocalize
                    WriteUninstaller $INSTDIR\Extensions\un_${PRODUCT_EXTENSION}.exe
                    StrCpy $_unSetup 1

                    un_SecLocalize:

               SectionEnd
          !endif

          !ifdef _Locales_Up
               Section ${PRODUCT_LOCALE} SecLocales
                    SectionIn RO

                    StrCpy $R1 "N" ; all
                    StrCpy $R2 "Y" ; overwrite

                    FindFirst $0 $1 "$INSTDIR\Locales\??-??"

                    Other_Language:
                    StrCmp $1 '' Kml_done
                    IfFileExists "$INSTDIR\locales\$1\${PRODUCT_LOCALE}" 0 Kml_Lang
                    StrCmp $R1 "Y" Continue_Kml 0
                    MessageBox MB_YESNO $(File_Exists) IDYES Flag_Copy IDNO Flag_NoCopy

                    Flag_Copy:
                    StrCpy $R2 "Y"
                    goto Warn_Copy

                    Flag_NoCopy:
                    StrCpy $R2 "N"

                    Warn_Copy:
                    StrCmp $R1 "Y" Continue_Kml 0
                    MessageBox MB_YESNO $(Treat_All) IDYES Flag_NoWarn IDNO Continue_Kml

                    Flag_NoWarn:
                    StrCpy $R1 "Y"
                    goto Continue_Kml

                    Continue_Kml:
                    StrCmp $R2 "Y" 0 Next_Language

                    Kml_Lang:
                    push ${Default_Langs}${Optional_Langs}
                    push $1
                    call StrStr
                    pop $4
                    StrCpy $3 $4 5
                    StrCmp $3 '' 0 Kml_Copy
                    push "others"
                    pop $3

                    Kml_Copy:
                    SetOutPath "$INSTDIR\locales\$1"
                    StrCmp $3 "de-DE" 0 fr-FR
                    StrCmp $_KMShortVersion "1.1" 0 de1.5
                    File /nonfatal .\locales\de-DE\1.1\*.*
                    goto Kml_Detail

                    de1.5:
                    StrCmp $_KMShortVersion "1.5" 0 de1.6
                    File /nonfatal .\locales\de-DE\1.5\*.*
                    goto Kml_Detail

                    de1.6:
                    ; File /nonfatal .\locales\de-DE\1.6\*.*
                    goto Kml_Detail

                    fr-FR:
                    StrCmp $3 "fr-FR" 0 es-ES
                    StrCmp $_KMShortVersion "1.1" 0 fr1.5
                    File /nonfatal .\locales\fr-FR\1.1\*.*
                    goto Kml_Detail

                    fr1.5:
                    StrCmp $_KMShortVersion "1.5" 0 fr1.6
                    File /nonfatal .\locales\fr-FR\1.5\*.*
                    goto Kml_Detail

                    fr1.6:
                    ; File /nonfatal .\locales\fr-FR\1.6\*.*
                    goto Kml_Detail

                    es-ES:
                    ; change 'others' by your code
                    StrCmp $3 "es-ES" 0 others
                    StrCmp $_KMShortVersion "1.1" 0 es1.5
                    File /nonfatal .\locales\es-ES\1.1\*.*
                    goto Kml_Detail

                    es1.5:
                    StrCmp $_KMShortVersion "1.1" 0 es1.6
                    File /nonfatal .\locales\es-ES\1.5\*.*
                    goto Kml_Detail

                    es1.6:
                    ; File /nonfatal .\locales\es-ES\1.6\*.*
                    goto Kml_Detail

                    ; to add a language :
                    ; 1 - add your language folders (replace xx-YY by your real language codes): xx-XX\1.1, xx-XX\1.5 and xx-YY\1.6 (yet not used)
                    ; 2 - add your language code in Optional_Langs
                    ; 3 - change 'xx-YY' and 'xx' by your real language codes in the few commented lines
                    ; 4 - uncomment the few lines under

                    ; xx-YY:
                    ; StrCmp $3 "xx-YY" 0 others
                    ; StrCmp $_KMShortVersion "1.1" 0 xx1.5
                    ; File /nonfatal .\locales\xx-YY\1.1\*.*
                    ; goto Kml_Detail

                    ; xx1.5:
                    ; StrCmp $_KMShortVersion "1.1" 0 xx1.6
                    ; File /nonfatal .\locales\xx-YY\1.5\*.*
                    ; goto Kml_Detail

                    ; xx1.6:
                    ;; File /nonfatal .\locales\xx-YY\1.6\*.*
                    ; goto Kml_Detail

                    others:
                    StrCmp $3 "others" 0 Kml_Detail
                    StrCmp $_KMShortVersion "1.1" 0 ot1.5
                    File /nonfatal .\locales\others\1.1\*.*
                    goto Kml_Detail

                    ot1.5:
                    StrCmp $_KMShortVersion "1.1" 0 ot1.6
                    File /nonfatal .\locales\others\1.5\*.*
                    goto Kml_Detail

                    ot1.6:
                    ; File /nonfatal .\locales\others\1.6\*.*

                    Kml_Detail:
                    DetailPrint $(AddedFile)

                    Next_Language:
                    FindNext $0 $1
                    Goto Other_Language

                    Kml_done:

                    ; if uninstaller hasn't yet been created or updated, create it
                    StrCmp $_unSetup 1 un_SecLocale
                    WriteUninstaller $INSTDIR\Extensions\un_${PRODUCT_EXTENSION}.exe
                    StrCpy $_unSetup 1

                    un_SecLocale:

               SectionEnd
          !endif

     SubSectionEnd
!endif


; The uninstaller is defined in an external File which is included when compiling
; and which, obviously must be modified :)

Section Uninstall
     !include unsetup.nsi
SectionEnd


; Miscellaneous functions

Function .onInit

     !ifdef _Language_Add
          StrCmp ${LANG_CODE} $LANGUAGE WinVersion 0
          !ifdef _Defaults_Pref_i10n
               SectionSetFlags ${SecDefaults_Pref_i10n} 0
          !endif
          !ifdef _Defaults_Profile_Bookmarks
               SectionSetFlags ${SecDefaults_Profile_Bookmarks} 0
          !endif
          !ifdef _Defaults_Profile_Search
               SectionSetFlags ${SecDefaults_Profile_Search} 0
          !endif
     !endif
     StrCpy $_LaunchMessage $(MUI_FINISHPAGE_RUN_TEXT)
     StrCpy $_LaunchMessageSaved $(MUI_FINISHPAGE_RUN_TEXT)
     StrCpy $_unSetup 0
     goto Preview

     Preview:
     !ifdef _New_Presentation
          ;Extract InstallOptions INI files
          !insertmacro MUI_INSTALLOPTIONS_EXTRACT "preview.ini"
          !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${PRODUCT_PREVIEW}"
     !endif
     goto WinVersion

     WinVersion:
     !ifdef Win_Version
          call GetWindowsVersion
          pop $9
          StrCpy $_Winver $9
          StrCpy $_Suffix "cmd"
          StrCmp $_Winver "w9x" 0 +2
          StrCpy $_Suffix "bat"
          StrCpy $_RunIt "$INSTDIR\extensions\KMlaunch.$_Suffix"
          readEnvStr $9 "SHELL"
          StrCpy $0 $9 5
          StrCmp $0 "/bin/" 0 NoLinux
          StrCpy $_Winver "Linux"
     NoLinux:
     !endif

     FindWindow $0 "KMeleon Tray Control"
     StrCmp $0 0 FindKM 0
     goto QueryClose

     FindKM:
     FindWindow $0 "KMeleon"
     StrCmp $0 0 NoKMrunning 0

     QueryClose:
     MessageBox MB_OKCANCEL|MB_ICONSTOP "$(RunInsWarn)" IDCANCEL 0 IDOK CloseKM
     Abort

     CloseKM:
     call CloseKMeleon

     NoKMrunning:

FunctionEnd


Function un.onInit

     !insertmacro MUI_UNGETLANGUAGE
     ifsilent +3
     MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UN_EXPL)" IDYES +2
     Abort
     Nop

FunctionEnd


Function .onInstSuccess

     ; Delete some more files if needed
     !include deletion.nsi

     ; Extensions.ini update
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} Name "${PRODUCT_EXTENSION}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} Type "${PRODUCT_SUBTYPE}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} Version "${LONG_EXTENSION_VERSION}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} Builder "${EXTENSION_BUILDER}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} Setup "${SETUP_VERSION}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} SetupDate "${__TIMESTAMP__}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} OriginalName "${ORIGINAL_NAME}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} OriginalCreator "${ORIGINAL_CREATOR}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} OriginalSite "${ORIGINAL_WEBSITE}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} OriginalModified "${ORIGINAL_MODIFIED}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} InstallDate "${__TIMESTAMP__}"
     writeIniStr $INSTDIR\Extensions\Extensions.ini ${PRODUCT_EXTENSION} Mark "end_of_${PRODUCT_EXTENSION}"

     ; Store install_date in a txt File to be handled by KMESmanager
     IfFileExists "$INSTDIR\macros\KMdate.$_Suffix" KMdate 0
     FileOpen $1 "$INSTDIR\Extensions\KMdate.$_Suffix" "w"
     FileWrite $1 "@echo off"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "if r%1==r goto Nothing"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "@echo %DATE% %TIME% >"
     FileWriteByte $1 "34"
     FileWrite $1 "$INSTDIR\Extensions\%1.txt"
     FileWriteByte $1 "34"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 ":Nothing"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileClose $1

     KMdate:
     Exec '"$INSTDIR\Extensions\KMdate.$_Suffix" ${PRODUCT_EXTENSION}'

     ; Here is a batch to realize uninstall
     ; The uninstall can't work, if uninstall exe isn't located in K-Meleon root folder
     ; (I don't understand why?), so I move the unsetup exeFile under K-Meleon root Folder
     SetOutPath "$INSTDIR\Extensions"
     FileOpen $1 "$INSTDIR\Extensions\un_${PRODUCT_EXTENSION}.$_Suffix" "w"
     FileWrite $1 "@echo off"
     FileWriteByte $1 "13"
     FileWriteByte $1 10"
     FileWrite $1 "copy "
     FileWriteByte $1 "34"
     FileWrite $1 "$INSTDIR\Extensions\un_${PRODUCT_EXTENSION}.exe"
     FileWriteByte $1 "34"
     FileWrite $1 " "
     FileWriteByte $1 "34"
     FileWrite $1 "$INSTDIR"
     FileWriteByte $1 "34"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "del "
     FileWriteByte $1 "34"
     FileWrite $1 "$INSTDIR\Extensions\un_${PRODUCT_EXTENSION}.exe"
     FileWriteByte $1 "34"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWriteByte $1 "34"
     FileWrite $1 "$INSTDIR\un_${PRODUCT_EXTENSION}.exe"
     FileWriteByte $1 "34"
     FileWrite $1 " /S"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileClose $1

     ; KMEShelper.kmm update
     SetOutPath "$INSTDIR\macros"
     FileOpen $1 "$INSTDIR\macros\KMEShelper.txt" "w"
     IfFileExists "$INSTDIR\macros\KMEShelper.kmm" VerifyHelper 0
     FileWrite $1 "# ------------------------------------------------------------------------------"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "# File managed by KMES 2.1.0"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "# Don't modify it manually"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "# ------------------------------------------------------------------------------"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWriteByte $1 "36"
     FileWrite $1 "macroModules="
     FileWriteByte $1 "36"
     FileWrite $1 "macroModules."
     FileWriteByte $1 "34"
     FileWrite $1 "KMEShelper;"
     FileWriteByte $1 "34"
     FileWrite $1 ";"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "# ------------------------------------------------------------------------------"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "# PUBLIC variable used by KMESManager"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWriteByte $1 "36"
     FileWrite $1 "BatchSuffix="
     FileWriteByte $1 "34"
     FileWrite $1 $_Suffix
     FileWriteByte $1 "34"
     FileWrite $1 ";"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "# ------------------------------------------------------------------------------"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "_KMEScleaner_OnInit{"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWriteByte $1 "36"
     FileWrite $1 "BatchSuffix=="
     FileWriteByte $1 "34"
     FileWrite $1 "cmd"
     FileWriteByte $1 "34"
     FileWrite $1 "?"
     FileWriteByte $1 "36"
     FileWrite $1 "_run="
     FileWriteByte $1 "36"
     FileWrite $1 "BatchSuffix:"
     FileWriteByte $1 "36"
     FileWrite $1 "_run="
     FileWriteByte $1 "34"
     FileWrite $1 "command"
     FileWriteByte $1 "34"
     FileWrite $1 ";"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWriteByte $1 "36"
     FileWrite $1 "_cmd="
     FileWriteByte $1 "36"
     FileWrite $1 "_run."
     FileWriteByte $1 "34"
     FileWrite $1 " /c del /Q \"
     FileWriteByte $1 "34"
     FileWriteByte $1 "34"
     FileWrite $1 ".getfolder(Rootfolder)."
     FileWriteByte $1 "34"
     FileWrite $1 "\\un_*.*\"
     FileWriteByte $1 "34"
     FileWriteByte $1 "34"
     FileWrite $1 ";"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "length(r_eadfile(Getfolder(Rootfolder)." Warning : word modified, due to wiki syntax
     FileWriteByte $1 "34"
     FileWrite $1 "\\un_install."
     FileWriteByte $1 "34"
     FileWrite $1 "."
     FileWriteByte $1 "36"
     FileWrite $1 "BatchSuffix))>0?exec("
     FileWriteByte $1 "36"
     FileWrite $1 "_cmd):0;"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "}"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "# ------------------------------------------------------------------------------"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWriteByte $1 "36"
     FileWrite $1 "OnInit="
     FileWriteByte $1 "36"
     FileWrite $1 "OnInit."
     FileWriteByte $1 "34"
     FileWrite $1 "_KMEScleaner_OnInit;"
     FileWriteByte $1 "34"
     FileWrite $1 ";"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "# ------------------------------------------------------------------------------"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     goto AddExtension

     VerifyHelper:
     StrCpy $6 "#" 0
     FileOpen $2 "$INSTDIR\macros\KMEShelper.kmm" "r"

     VerifyNext:
     FileRead $2 $3
     StrCpy $4 $3 -2
     StrCmp $4 "#end_of_KMEShelper" ClearHelper 0
     StrCmp $4 "i_${PRODUCT_EXTENSION}{" VeriFlag 0
     StrCmp $4 '' 0 RazFlag
     StrCmp $6 "empty" 0 PutFlag
     goto VerifyNext

     PutFlag:
     StrCpy $6 "empty"
     goto CopyBefore

     RazFlag:
     StrCpy $6 "#" 0

     CopyBefore:
     FileWrite $1 "$3"
     goto VerifyNext

     VeriFlag:
     StrCpy $6 "#" 0

     VeriFound:
     FileRead $2 $3
     StrCpy $4 $3 -2
     StrCmp $4 "#end_of_${PRODUCT_EXTENSION}" NextCopy VeriFound

     NextCopy:
     FileRead $2 $3
     ClearErrors

     CopyNext:
     FileRead $2 $3
     IfErrors ClearHelper
     StrCpy $4 $3 -2
     StrCmp $4 "#end_of_KMEShelper" CopyNext 0
     FileWrite $1 "$3"
     goto CopyNext

     ClearHelper:
     FileClose $2
     goto AddExtension2

     AddExtension:
     FileSeek $1 0 END
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"

     AddExtension2:
     FileWrite $1 "i_${PRODUCT_EXTENSION}{"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWriteByte $1 "36"
     FileWrite $1 '__Extension="${PRODUCT_EXTENSION}";'
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "&_KMES_Properties;"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "}"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "#end_of_${PRODUCT_EXTENSION}"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "#end_of_KMEShelper"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"

     FileClose $1

     Delete "$INSTDIR\macros\KMEShelper.kmm"
     Rename "$INSTDIR\macros\KMEShelper.txt" "$INSTDIR\macros\KMEShelper.kmm"

     ; Do other work if needed
     !include MoreToDo.nsi

     !ifdef DONT_RUN_K-MELEON
          MessageBox MB_OK|MB_ICONEXCLAMATION "$(NSIS_LIMITATION_1)$\n$\n$(NSIS_LIMITATION_2)"
     !endif

FunctionEnd


; Presentation

!ifdef _Presentation

     !ifdef _Old_Presentation
          Function Presentation

               SetOutPath "$INSTDIR\extensions"
               StrCmp $(LOCALE_NAME) English" 0 Present_Fr
               File .\Presentation\English*.*
               goto Present_done
               Present_Fr:
               StrCmp $(LOCALE_NAME) "French" 0 Present_De
               File .\Presentation\French*.*
               goto Present_done
               Present_De:
               StrCmp $(LOCALE_NAME) "German" 0 Present_Es
               File .\Presentation\German*.*
               goto Present_done
               Present_Es:
               StrCmp $(LOCALE_NAME) "Spanish" 0 Present_done
               File .\Presentation\Spanish*.*

               Present_done:
               ExecShell "open" '"$INSTDIR\extensions\$(PRESENTATION)"'
               Sleep 250

          FunctionEnd
     !endif

     !ifdef _New_Presentation
          Function Preview_Page

               !ifdef _Skin_Message
                    !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_SKIN_SUBTITLE)"
               !else
                    !ifdef _Menu_Message
                         !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_MENU_SUBTITLE)"
                    !else
                         !ifdef _Box_Message
                              !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_BOX_SUBTITLE)"
                         !endif
                    !endif
               !endif
               StrCmp $_Winver "Linux" 0 WinOK
               File "${PRODUCT_PREVIEW}"
               File "preview.cmd"
               Exec "preview.cmd ${PRODUCT_PREVIEW}"
          goto TuxOK
     WinOK:
               !insertmacro MUI_INSTALLOPTIONS_WRITE "preview.ini" "Field 1" "Text" "$PLUGINSDIR\${PRODUCT_PREVIEW}"
               !insertmacro MUI_INSTALLOPTIONS_DISPLAY "preview.ini"
     TuxOK:

          FunctionEnd
     !endif

!endif


; Close K-Melon Functions

Function CloseKMeleon

     push $0

     loop1:
     FindWindow $0 "KMeleon Tray Control"
     IntCmp $0 0 loop2
     SendMessage $0 16 0 0
     Sleep 200
     goto loop2

     loop2:
     FindWindow $0 "KMeleon"
     IntCmp $0 0 done
     SendMessage $0 16 0 0
     Sleep 200
     goto loop1

     done:
     pop $0
FunctionEnd


; Compare K-Meleon version found to allowed string

Function DirectoryLeave

     call GetK-MeleonVersion

     StrCpy $_RunIt "$INSTDIR\extensions\KMlaunch.$_Suffix"

     StrCpy $R0 $_KmeleonVersion 3
     StrCpy $R1 $R0
     push ${ALLOWED_VERSION}
     push $R1
     call StrStr
     pop $R4
     StrCpy $_KMShortVersion $R4 3

     !ifdef EQUATE_VERSION
          StrCpy $R1 ${EQUATE_VERSION} 3
          StrCpy $R2 ${EQUATE_VERSION} '' -3
          StrCmp $R2 $_KMShortVersion 0 Equate
          StrCpy $_KMShortVersion $R1
          StrCpy $R0 $R1
     !endif
     goto Equate

     Equate:
     StrCmp $R0 $_KMShortVersion Done IncorrectVersion

     IncorrectVersion:
     StrCpy $_LaunchMessage $_LaunchMessageSaved
     MessageBox MB_OK "$(BadVersion)" IDOK 0
     Abort

     Done:
     IfFileExists "$INSTDIR\extensions\KMlaunch.$_Suffix" Now_we_continue 0
     FileOpen $1 "$INSTDIR\extensions\KMlaunch.$_Suffix" "a"
     FileWrite $1 "@echo off"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "echo:"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "echo "
     FileWrite $1 $(NSIS_LIMITATION_3)
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "echo:"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "echo "
     FileWrite $1 $(NSIS_LIMITATION_4)
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "echo _______________________________________________________________________________"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "echo:"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWrite $1 "pause"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"
     FileWriteByte $1 "34"
     FileWrite $1 "$INSTDIR\K-Meleon.exe"
     FileWriteByte $1 "34"
     FileWriteByte $1 "13"
     FileWriteByte $1 "10"

     FileClose $1

     Now_we_continue:

FunctionEnd


; Keep the K-Meleon Version where to install Extension

!ifdef _KmVersion
     Function GetK-MeleonVersion

          StrCpy $R0 "$INSTDIR\${PRODUCT_NAME}.exe"
          push $R0
          call GetVersion
          pop $R0
          StrCpy $R1 $R0 1 0
          StrCpy $R2 $R0 1 2
          StrCpy $R9 $R0
          StrCpy $_KmeleonVersion $R9
          StrCpy $_LaunchMessage $_LaunchMessage$_KmeleonVersion

     FunctionEnd
!endif


; Return DLL or EXE Version

!ifdef _KmVersion
     Function GetVersion

          Exch $0
          push $1
          push $2
          push $3
          push $4
          push $5
          push $6

          GetDllVersion '$0' $1 $2
          IntOp $3 $1 / 0x00010000
          IntOp $4 $1 & 0x0000FFFF
          IntOp $5 $2 / 0x00010000
          IntOp $6 $2 & 0x0000FFFF
          StrCpy $0 '$3.$4.$5.$6'

          pop $6
          pop $5
          pop $4
          pop $3
          pop $2
          pop $1
          Exch $0

     FunctionEnd
!endif


; Return Windows Version

!ifdef Win_Version
     Function GetWindowsVersion

          push $R0
          push $R1

          ClearErrors

          ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion

          IfErrors 0 lbl_winnt

           ; it's not NT
          ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber

          StrCpy $R1 $R0 1
          StrCmp $R1 '4' 0 lbl_error

          StrCpy $R1 $R0 3

          StrCmp $R1 '4.0' lbl_win32_95
          StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98

          lbl_win32_95:
          # What is interesting is here : Is-it a w9x system ?
          # StrCpy $R0 '95'
          StrCpy $R0 'w9x'
          goto lbl_done

          lbl_win32_98:
          # What is interesting is here : Is-it a w9x system ?
          # StrCpy $R0 '98'
          StrCpy $R0 'w9x'
          goto lbl_done

          lbl_win32_ME:
          # What is interesting is here : Is-it a w9x system ?
          # StrCpy $R0 'ME'
          StrCpy $R0 'w9x'
          goto lbl_done

          lbl_winnt:

          StrCpy $R1 $R0 1

          StrCmp $R1 '3' lbl_winnt_x
          StrCmp $R1 '4' lbl_winnt_x

          StrCpy $R1 $R0 3

          StrCmp $R1 '5.0' lbl_winnt_2000
          StrCmp $R1 '5.1' lbl_winnt_XP
          StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error

          lbl_winnt_x:
          StrCpy $R0 "NT $R0" 6
          goto lbl_done

          lbl_winnt_2000:
          StrCpy $R0 '2000'
          goto lbl_done

          lbl_winnt_XP:
          StrCpy $R0 'XP'
          goto lbl_done

          lbl_winnt_2003:
          StrCpy $R0 '2003'
          goto lbl_done

          lbl_error:
          StrCpy $R0 ''
          lbl_done:

          pop $R1
          Exch $R0

     FunctionEnd
!endif


; String search function
; StrStr
; entrée, haut de la pile = chaine a rechercher
; haut de la pile-1 = chaine dans laquelle chercher
; sortie, haut de la pile (remplacement avec la portion de la chaine restante)
; ne modifie aucune autre variable.
;
; Usage:
; push "c'est une putain de longue chaine"
; push "putain"
; call StrStr
; pop $R0
; ($R0 at this point is "putain de longue chaine")

!ifdef _StrStr
      Function StrStr
          Exch $R1 ; st=tete,vieux$R1, $R1=pointeur
          Exch >; st=vieux$R1,tete
          Exch $R2 ; st=vieux$R1,vieux$R2, $R2=tete
          push $R3
          push $R4
          push $R5
          StrLen $R3 $R1
          StrCpy $R4 0
          ; $R1=pointeur
          ; $R2=tete
          ; $R3=taille(pointeur)
          ; $R4=cnt
          ; $R5=tmp

          loop:
          StrCpy $R5 $R2 $R3 $R4
          StrCmp $R5 $R1 done
          StrCmp $R5 '' done
          IntOp $R4 $R4 + 1
          goto loop

          done:
          StrCpy $R1 $R2 '' $R4
          pop $R5
          pop $R4
          pop $R3
          pop $R2
          Exch $R1

     FunctionEnd
!endif


<<< Previous page           Next page >>>

Aucun commentaire !

Ajouter un commentaire à cette page :

Seuls les membres peuvent ajouter des commentaires.
Utilisez la page de connexion pour vous inscrire.


- Merci de commencer par consulter l'aide.
- Pour des demandes d'aide, pensez au forum.
- Le lien ne fonctionne pas ? Commencez SVP par lire la page installer une extension.

Les commentaires vulgaires, blessants ou injurieux seront supprimés. Merci de faire des critiques constructives qui nous aideront à nous améliorer.

Le code HTML dans le commentaire sera affiché comme du texte. Pour formater votre texte vous pouvez utiliser la syntaxe Wiki :

Règles de base :
**Texte en gras !** ---> Texte en gras !
//Texte en italique.// ---> Texte en italique.
##texte à espacement fixe## ---> texte à espacement fixe
[[http://www.geckozone.org Lien vers Geckozone]] ---> Lien vers Geckozone