How can modify scripts of Notepad++ opsi package, to manually change the language??
Verfasst: 10 Jan 2018, 16:44
Hi,
I had a question. How can I modify scripts of Notepad++ opsi package, so that when a user open notepad++, he can see a message, where he can select his favorite language?
these are my scripts:
Setup. opsiscript:
Delsub.opsiscript:
Uninstall.opsiscript:
I had a question. How can I modify scripts of Notepad++ opsi package, so that when a user open notepad++, he can see a message, where he can select his favorite language?
these are my scripts:
Setup. opsiscript:
Code: Alles auswählen
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.4.4"
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $Setupfile$
DefVar $InstallSilentOption$
DefVar $ExitCode$
DefVar $PrettyName$
DefVar $InstallDirExe$
DefVar $CustomPostInstall$
DefVar $CustomPostDeinstall$
DefVar $Updater$
DefVar $Language$
DefVar $LangSourceFile$
Set $Language$ = GetProductProperty("language","auto")
set $Updater$ = getProductProperty("updater","no")
Set $LogDir$ = "%opsiLogDir%"
Set $ProductId$ = "notepadpp"
Set $PrettyName$ = "Notepad++"
Set $MinimumSpace$ = "25 MB"
Set $InstallDir$ = "%ProgramFilesDir%\Notepad++"
Set $InstallDirExe$ = $InstallDir$ + "\npp.exe"
Set $InstallSilentOption$ = " /S "
DefVar $SetupVersion$
Set $SetupVersion$ = strPart("%installingProdVersion%", "1", calculate(strPos("%installingProdVersion%","-") + "-" + "1" ))
Set $Setupfile$ = "npp.exe"
; ----------------------------------------------------------------
ChangeDirectory "%SCRIPTPATH%"
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
isFatalError "No Space"
else
comment "Space OK"
endif
if not( FileExists($Setupfile$) )
LogError "Setupfile NOT exists (" + $Setupfile$ +")"
isFatalError "No Setupfile found"
else
comment "Setupfile exists ..."
endif
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $PrettyName$
if FileExists("%ScriptPath%\delsub.opsiscript")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub.opsiscript"
endif
Message "Installing %installingProdName% (%installingProdVersion%) ..."
comment "Start setup program"
Winbatch_install
Sub_check_exitcode
if ($language$ = "auto")
comment "decide which language to use"
DefStringList $LanguageMap$
DefVar $System_Language$
set $languagemap$ = GetLocaleInfoMap
set $system_language$ = lower(getValue("system_default_language_id", $languagemap$))
if $system_language$ = "0407"
comment "The detected language code is German"
Set $LangSourceFile$ = "german.xml"
endif
if $system_language$ = "0409"
comment "The detected language code is English"
Set $LangSourceFile$ = "english.xml"
endif
endif
if ($language$ = "de")
Set $LangSourceFile$ = "german.xml"
endif
if ($language$ = "en")
Set $LangSourceFile$ = "english.xml"
endif
comment "Generating 'nativeLang.xml'"
Files_copy_lang
comment "Installing Plugins"
Files_copy_plugins
if ($Updater$ = "no")
comment "Patch XML config file"
; Patche die XML im Installationsverzeichnis, dass nicht nach updates gesucht werden soll!
; http://coreworx.blogspot.de/2010/07/unattended-installation-notepad.html
XMLPatch_config $InstallDir$ + "\config.model.xml"
; das Verzeichnis 'updater' im Programmverzeichnis einfach löschen, dann verschwinden auch die Menüeinträge unter 'Hilfe'
comment "Remove updater directory"
Files_uninstall_updater
endif
comment "include custom post install file"
set $CustomPostInstall$ = getProductProperty("custom-post-install","none")
if not ($CustomPostInstall$ = "none")
if FileExists("%ScriptPath%\custom\" + $CustomPostInstall$)
include_insert "%ScriptPath%\custom\" + $CustomPostInstall$
endif
endif
[Winbatch_install]
"%ScriptPath%\$Setupfile$" $InstallSilentOption$
[Files_copy_lang]
; etwas umständlich (kopieren und dann umbenennen und verschieben), aber wird von copy imo nicht unterstützt
copy "$InstallDir$\localization\$LangSourceFile$" "$InstallDir$"
move "$InstallDir$\$LangSourceFile$" "$InstallDir$\nativeLang.xml"
[Files_copy_plugins]
copy "%ScriptPath%\plugins\ComparePlugin.dll" "$InstallDir$\plugins"
[Files_uninstall_updater]
delete -sf "$InstallDir$\updater"
[XMLPatch_config]
openNodeSet
documentroot
all_childelements_with:
elementname: "GUIConfigs"
all_childelements_with:
elementname: "GUIConfig"
attribute: "name" value="noUpdate"
end
SetText "yes"
[Sub_check_exitcode]
Sub "%ScriptPath%\check_inno-exitcode.opsiscript"
Code: Alles auswählen
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe"
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists($UninstallProgram$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall
sub_check_exitcode
; Installer räumt nicht richtig auf, außerdem muss 'nativeLang.xml' noch entsorgt werden
comment "Clean up installdir"
Files_uninstall
comment "include custom post deinstall file"
set $CustomPostDeinstall$ = getProductProperty("custom-post-deinstall","none")
if not ($CustomPostDeinstall$ = "none")
if FileExists("%ScriptPath%\custom\" + $CustomPostDeinstall$)
include_insert "%ScriptPath%\custom\" + $CustomPostDeinstall$
endif
endif
endif
[Winbatch_uninstall]
; === Inno Setup ========================================================================================
"$UninstallProgram$" /S
[Files_uninstall]
delete -sf "$InstallDir$"
[Sub_check_exitcode]
Sub "%ScriptPath%\check_inno-exitcode.opsiscript"
Code: Alles auswählen
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.4.4"
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir$
DefVar $CustomPostDeinstall$
DefVar $PrettyName$
Set $LogDir$ = "%opsiLogDir%"
; ----------------------------------------------------------------
Set $ProductId$ = "notepadpp"
Set $PrettyName$ = "Notepad++"
Set $InstallDir$ = "%ProgramFilesDir%\Notepad++"
; ----------------------------------------------------------------
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $PrettyName$
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists("%ScriptPath%\delsub.opsiscript")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub.opsiscript"
endif