; ---------------------------------------------------- ; PortableAudacity ; ---------------------------------------------------- ; Par fat115 ; Utilisant comme base de travail les scripts de John T. Haller et Sarkos et pyg ; License : GPL ; Ce script permet de créer le lanceur de PortableAudacity. ; Compiler: NSIS (http://www.nullsoft.com). ; Require plugins: newadvsplash ; $id=PortableAudacity.nsi $date=2009-05-31 ; ---------------------------------------------------- ;Copyright (C) 2005-2007 Framakey ;Website: http://www.framakey.org ;This software is OSI Certified Open Source Software. ;OSI Certified is a certification mark of the Open Source Initiative. ;This program is free software; you can redistribute it and/or ;modify it under the terms of the GNU General Public License ;as published by the Free Software Foundation; either version 2 ;of the License, or (at your option) any later version. ;This program is distributed in the hope that it will be useful, ;but WITHOUT ANY WARRANTY; without even the implied warranty of ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;GNU General Public License for more details. ;You should have received a copy of the GNU General Public License ;along with this program; if not, write to the Free Software ;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ; ---------------------------------------------------- ; Général ; ---- Modifiez les valeurs souhaitées ---- ; Définition variables entête !define APPLANG "Fr" !define NAME "PortableAudacity" !define FULLNAME "PortableAudacity" !define APP "Audacity" !define VER "1.3.7.0" !define WEBSITE "http://www.framakey.org" !define DEFAULTEXE "audacity.exe" !define DEFAULTAPPDIR "Audacity" ; Etiquette Caption "${FULLNAME} - Logiciel de traitement du son" ; ---------------------------------------------------- ; ---- à partir de là, vous n'avez normalement rien à modifier --- ; ---- Mouais, c'était vite dit ---- ; Nom de l'exécutable Name "${NAME}" ; Icone Icon "${NAME}.ico" WindowIcon Off ; Nom du fichier à créer OutFile "${NAME}.exe" ; Runtime Switches SetDateSave on CRCCheck On SilentInstall Silent AutoCloseWindow True ; Best Compression SetCompress Auto SetCompressor /SOLID lzma SetCompressorDictSize 32 SetDatablockOptimize On ;=== Include ;(Standard NSIS) !include FileFunc.nsh !insertmacro GetParameters ;Requires NSIS 2.40 or better !include StrFunc.nsh ${StrRep} ; ---------------------------------------------------- ; Variables Var IniPath Var DataDir Var AppDirectory Var LameDirectory Var AppExecutable Var AdditionalParameters Var DisableSplashScreen Var Drive Var ExecString ; Inclusion langue française (ajout de sarkos) LoadLanguageFile "${NSISDIR}\Contrib\Language Files\French.nlf" ; ---------------------------------------------------- ; Version Informations VIProductVersion "${VER}" VIAddVersionKey FileDescription "${FULLNAME} pour Windows" VIAddVersionKey LegalCopyright "GPL" VIAddVersionKey Comments "Permet de lancer ${APP} (${APPLANG}) depuis un disque amovible. Pour plus de détails, visitez ${WEBSITE}" VIAddVersionKey CompanyName "Framakey" VIAddVersionKey OriginalFilename "${NAME}.exe" VIAddVersionKey FileVersion "${VER}" ; ---------------------------------------------------- ; Sections Section "Main" ; Trouver le fichier INI, s'il y en a un IfFileExists "$EXEDIR\${NAME}.ini" "" CheckDataINI StrCpy "$IniPath" "$EXEDIR" Goto ReadINI CheckDataINI: ${GetRoot} "$EXEDIR" $0 StrCpy "$DataDir" "$0\Data\AppsData" IfFileExists "$DataDir\${APP}\${NAME}.ini" "" NoINI StrCpy "$IniPath" "$DataDir\${APP}" Goto ReadINI ReadINI: ; Lit les paramètres du fichier INI ReadINIStr $0 "$IniPath\${NAME}.ini" "${NAME}" "${APP}Directory" StrCpy "$AppDirectory" "$EXEDIR\$0" ; Vérifie que les paramètres requis ci-dessus sont présents IfErrors NoINI ReadINIStr $0 "$IniPath\${NAME}.ini" "${NAME}" "AdditionalParameters" StrCpy "$AdditionalParameters" $0 ReadINIStr $0 "$IniPath\${NAME}.ini" "${NAME}" "${APP}Executable" StrCpy "$AppExecutable" $0 ReadINIStr $0 "$IniPath\${NAME}.ini" "SplashScreen" "DisableSplashScreen" StrCpy "$DisableSplashScreen" $0 ReadINIStr $0 "$IniPath\${NAME}.ini" "${NAME}" "LameDirectory" StrCpy "$LameDirectory" "$EXEDIR\$0" ; Pour n'importe quel paramètre du fichier INI non requis contenant une chaine vide, ignorer les erreurs associées ClearErrors ; Corrige PROGRAMEXECUTABLE si paramètre vide StrCmp $AppExecutable "" "" EndINI StrCpy "$AppExecutable" "${DEFAULTEXE}" Goto EndINI NoINI: ; Pas de fichier INI, nous utiliserons les paramètres par défaut StrCpy "$AdditionalParameters" "" StrCpy "$AppExecutable" "${DEFAULTEXE}" StrCpy "$DisableSplashScreen" "false" StrCpy "$LameDirectory" "$EXEDIR\Libs" IfFileExists "$EXEDIR\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" NoProgramEXE StrCpy "$AppDirectory" "$EXEDIR\${DEFAULTAPPDIR}" GoTo EndINI EndINI: IfFileExists "$AppDirectory\$AppExecutable" FoundProgramEXE NoProgramEXE: ; Si le chemin pointant vers l'exécutable est invalide MessageBox MB_OK|MB_ICONEXCLAMATION `$AppExecutable est introuvable. Vérifiez votre configuration` Abort FoundProgramEXE: FindProcDLL::FindProc "$AppExecutable" StrCmp $R0 "1" "" WriteSettingsOut MessageBox MB_OK|MB_ICONEXCLAMATION "${APP} est déjà lancé." Abort WriteSettingsOut: ; Modifie les chemins du fichier de configuration ${StrRep} $0 "$TEMP\audacity_temp" "\" "\\" WriteINIStr "$AppDirectory\Portable Settings\audacity.cfg" "Directories" "TempDir" $0 ${StrRep} $0 "$AppDirectory\Portable Settings\presets" "\" "\\" WriteINIStr "$AppDirectory\Portable Settings\audacity.cfg" "Directories" "PresetsDir" "$0" ${StrRep} $0 "$LameDirectory\lame_enc.dll" "\" "\\" WriteINIStr "$AppDirectory\Portable Settings\audacity.cfg" "MP3" "MP3LibPath" "$0" ${StrRep} $0 "$LameDirectory\avformat-52.dll" "\" "\\" WriteINIStr "$AppDirectory\Portable Settings\audacity.cfg" "FFmpeg" "FFmpegLibPath" "$0" StrCmp $DisableSplashScreen "true" CheckDrive ; Affiche le splash screen InitPluginsDir File /oname=$PLUGINSDIR\splash.jpg "${NAME}_splash.jpg" newadvsplash::show /NOUNLOAD 2000 200 200 -1 /L $PLUGINSDIR\splash.jpg ; Trouve la lettre du lecteur CheckDrive: ${GetRoot} "$EXEDIR" $0 StrCpy "$Drive" "$0" ; Check des paramètres GetAppParameters: ${GetParameters} $0 ; Routine si pas de paramètres StrCmp "'$0'" "''" "" ExecWithParameters StrCpy $ExecString `"$AppDirectory\$AppExecutable"` Goto AdditionalParameters ; Routine si paramètres ExecWithParameters: StrCpy $ExecString `"$AppDirectory\$AppExecutable" $0` Goto ExecApp AdditionalParameters: StrCmp $AdditionalParameters "" ExecApp ; Additional Parameters StrCpy $ExecString `$ExecString $AdditionalParameters` ; Lancement De l'application ExecApp: ExecWait "$ExecString" End: ; Efface le répertoire temporaire RMDir "$TEMP\audacity_temp\" newadvsplash::stop /WAIT SectionEnd ; ------------------------------------------- ; Fin du script