Archive: Problem with a path and a var


Problem with a path and a var
Hi community!

i want to make an installer for every plugin / addin which we release.

When the installer runs it should get the content of the following registry path:
HKLM SOFTWARE\MESAP\Mesap4\Directories "UIMdb"

And of course... it works.. when i test it i get the directory of the software (f.e. C:\Program Files\Mesap4\).

So now the problem is, that i have to put files in to these folder.
The following problem:

        ReadRegStr $MesapDir HKLM SOFTWARE\MESAP\Mesap4\Directories "UIMdb" 
...to get the path into $MesapDir

        StrCpy $UninstallExe "$MesapDirUninstall - $AddInName.exe" 
...to create the uninstaller.

        RegDLL "$MesapDir$DllFile.dll" 
...to register the copied dll-files.

But of course all these phrases doesn't work!
What do i have to do to make it work? $MesapDir\*rest* doesn't work because there are two backslashes... :-(

can anyone help please?
greetz, scorpion

PS: german is also ok (or much better!)

I started thinking it was the $MespaDir variable, but then realized you never said what $DllFile.dll was set to. I'll bet you have it starting with a backslash. Fix that and it should fix your issue. (or remove the trailing backslash from $MespaDir).


$DllFile is not the only thing which needs the $MesapDir variable.
Its also needed for the startmenu shortcut etc.

But how can i remove the \ of the path inside of $MesapDir?


here's one way:

!include logiclib
!include WordFunc.nsh
!insertmacro WordReplace
...

ReadRegStr $MesapDir HKLM SOFTWARE\MESAP\Mesap4\Directories "UIMdb"
${WordReplace} "$MesapDir" "\" "" "-1" $MesapDir

I guess you mean this:

!include logiclib.nsh

But when i try to compile the script i get the following log:


MakeNSIS v2.39 - Copyright 1995-2008 Contributors
See the file COPYING for license details.
Credits can be found in the Users Manual.

Processing config:
Processing plugin dlls: "C:\Program Files\NSIS\Plugins\*.dll"
- AdvSplash::show
- Banner::destroy
- Banner::getWindow
- Banner::show
- BgImage::AddImage
- BgImage::AddText
- BgImage::Clear
- BgImage::Destroy
- BgImage::Redraw
- BgImage::SetBg
- BgImage::SetReturn
- BgImage::Sound
- Dialer::AttemptConnect
- Dialer::AutodialHangup
- Dialer::AutodialOnline
- Dialer::AutodialUnattended
- Dialer::GetConnectedState
- InstallOptions::dialog
- InstallOptions::initDialog
- InstallOptions::show
- LangDLL::LangDialog
- Math::Script
- NSISdl::download
- NSISdl::download_quiet
- Splash::show
- StartMenu::Init
- StartMenu::Select
- StartMenu::Show
- System::Alloc
- System::Call
- System::Copy
- System::Free
- System::Get
- System::Int64Op
- System::Store
- TypeLib::GetLibVersion
- TypeLib::Register
- TypeLib::UnRegister
- UserInfo::GetAccountType
- UserInfo::GetName
- UserInfo::GetOriginalAccountType
- VPatch::GetFileCRC32
- VPatch::GetFileMD5
- VPatch::vpatchfile
- nsDialogs::Create
- nsDialogs::CreateControl
- nsDialogs::CreateItem
- nsDialogs::GetUserData
- nsDialogs::OnBack
- nsDialogs::OnChange
- nsDialogs::OnClick
- nsDialogs::OnNotify
- nsDialogs::SelectFileDialog
- nsDialogs::SelectFolderDialog
- nsDialogs::SetRTL
- nsDialogs::SetUserData
- nsDialogs::Show
- nsExec::Exec
- nsExec::ExecToLog
- nsExec::ExecToStack

!define: "MUI_INSERT_NSISCONF"=""

Changing directory to: "P:\Mesap Setup TEST\NSIS\AddIn-Setups\TempFiles"

Processing script file: "P:\Mesap Setup TEST\NSIS\AddIn-Setups\TempFiles\MPD ControlPanel.nsi"
SetCompress: force
SetCompressor: /SOLID lzma
Name: "Mesap 4 AddIn Installation"
OutFile: "MPD ControlPanel.exe"
XPStyle: on
!include: "C:\Program Files\NSIS\Include\LogicLib.nsh"
!include: closed: "C:\Program Files\NSIS\Include\LogicLib.nsh"
!include: "C:\Program Files\NSIS\Include\WordFunc.nsh"
!define: "WORDFUNC_INCLUDED"=""
!include: closed: "C:\Program Files\NSIS\Include\WordFunc.nsh"
!insertmacro: WordReplace
!insertmacro: end of WordReplace
Page: instfiles
UninstPage: uninstConfirm
UninstPage: instfiles
VIAddVersionKey: "ProductName" "M4AddIn011"
VIAddVersionKey: "Comments" "Setup für MPD ControlPanel"
VIAddVersionKey: "CompanyName" "Seven2one GmbH"
VIAddVersionKey: "LegalCopyright" "Seven2one GmbH"
VIAddVersionKey: "FileDescription" "MPD ControlPanel"
Var: "AddInName"
Var: "DllFile"
Var: "MesapDir"
Var: "UninstallExe"
Function: ".onInit"
ReadRegStr $MesapDir HKLM\SOFTWARE\MESAP\Mesap4\Directories\UIMdb
!insertmacro: WordReplaceCall
!insertmacro: end of WordReplaceCall
StrCpy $AddInName "MPD ControlPanel" () ()
StrCpy $DllFile "M4AddIn011" () ()
StrCpy $UninstallExe "$MesapDir\Uninstall - $AddInName.exe" () ()
FunctionEnd
Function: "un.onInit"
ReadRegStr $MesapDir HKLM\SOFTWARE\MESAP\Mesap4\Directories\UIMdb
!insertmacro: WordReplaceCall
Call must be used with function names starting with "un." in the uninstall section.
Usage: Call function_name | [:label_name]
Error in macro WordReplaceCall on macroline 7
Error in script "P:\Mesap Setup TEST\NSIS\AddIn-Setups\TempFiles\MPD ControlPanel.nsi" on line 39 -- aborting creation process

yes, I did mean LogicLib.nsh. (my bad)

And the error is that you are trying to use this in the uninstall section. (When I read your original post, I thought you were in the install section. But your error log shows you are in the uninstall function un.onInit)

To use WordReplace in an uninstaller place a "un." in front.

So "!insertmacro WordReplace" becomes "!insertmacro un.WordReplace"
and
"${WordReplace}" becomes "${un.WordReplace}".