Archive: Plugin for my application


Plugin for my application
Dear Community -

I have a problem of creating a plugin for my main-application (MY-APP). In fact I don't know how to plug in.

The idea I had was to make MY-APP write a registry key to HKLM SOFTWARE\MY-APP with the value InstallPath with (guess what) the installation path of MY-APP (e.g. C:\Program Files\My-App)

So how can I use this value as new $INSTDIR for the plugin?

Thx in advance
Chris


Use ReadRegStr and then set the folder using SetOutPath.

If you prefer to use the $INSTDIR variable use StrCpy and SetOutPath.


Thx for your reply, I already gave it (a successful) try, but allow me one more question Joost. I did it like this

Function getInstallPath
ReadRegStr $R9 HKLM "SOFTWARE\MY-APP" "InstallPath"
StrCmp $R9 "" done
done:
FunctionEnd


Where do I have to paste a potential abortion if the main application isn't installed and is it possible to handle this "globaly", or do I have to call this function everytime I need it (e.g. section, uninstaller, etc.)?

Chris

I try to write the abortion option mentioned above. Therefore I (tried to) analyize the waplugin example shipped with the NSIS package. I found the "IfFileExists" and now I want to know if there is something similar for registrykeys?

Chris


Yes. Everytime you call ReadRegStr it can return a value if it exists or set errors if it doesn't exist.


So can you please tell what I have to set and where I have to place it?

Right now the installation would be already impossible if the core package is not installed. But you get an *cancel - retry - ignore* messagebox because the installpath is invalid (it tries to install to a path starting with a '\' not C:\ or D:\).

Chris


Put it inside .onInstFailed callback function.


Sorry deguix, this makes no sense to me (! and only me !), so please help me out:

This callback is called when the user hits the 'cancel' button after the install has failed (if it could not extract a file, or the install script used the Abort command)
Would this trigger the installer to stop automatically from installing (or even not to enable the install button like in the waplugin example) if the registry key is not found?

Thx
Chris

Ahhhhh... The components page... I thought that was the installation part...

Ok, put that inside the callback function .onVerifyInstDir.


Hm, I gave it a try, but without the desired result. Any other ideas?


Why not just check for the registry value in the .onInit function and quit the installer with an error message if it is not present?
Slightly adapting the example from the NSIS documentation, you could use:


Function .onInit
ReadRegStr $INSTDIR HKLM "SOFTWARE\MY-APP" "Path"
StrCmp $INSTDIR "" 0 NoAbort
MessageBox MB_OK "MY-APP not found. Unable to get install path."
Abort ; causes installer to quit.
NoAbort:
FunctionEnd

Thx Iceman_K
That's it. It works.
Your my man :D