Archive: Q: Example for Registry solution problem


Q: Example for Registry solution problem
Hello,

we're linux experts and we don't know registy :(
This is our problem:
With a format already used by other programs (e.g. .jpg or .pdf) we want to add
a new
WriteRegStr HKCR "TXTFile\shell\compile\command"
to the existing ones

Please can you send us an .nsi example (probably is not a bad idea to add it
also to NSIS examples.

Thanks

SANFACE Software team


NSIS Examples
The makensis.nsi script has a section "NSI Development Shell Extensions" which might be helpful. It should have been installed if you chose a Full install or selected the example files that comes with NSIS.


Re: NSIS Examples
Thanks,

this is exactly the example we studied.
The problem is that this example use Write and rewrite the precedent configuration. We'd like to add a new command to the existing commands.

SANFACE Software team


Hi sanface,

I am guessing you want to add the 'Compile' command to the right-click menu of a TXT file.

The simplest way of doing this is:

  WriteRegStr HKCR TXTFile\Shell\Compile\Command '' `"$INSTDIR\Your Program.exe" "%1"`
where '$INSTDIR\Your Program.exe' is your program, and '"%1"' is the TXT file, sent to your program as a parameter surrounded by double quotes.

But because you can't be absolutely sure of the key, you should check the extension to see where it points:

  ReadRegStr $0 HKCR .TXT ''
WriteRegStr HKCR $0\Shell\Compile\Command '' `"$INSTDIR\Your Program.exe" "%1"`
If you like, you can reply with the actual extension, the name that should appear on the right-click menu, and the program that should run, and I'll write the piece of script for you, that will take care of the association.

Thanks
Petersa,

Thanks you've understood our problem:
following your notes we've tried to use
ReadRegStr $0 HKCR .PDF ''
WriteRegStr HKCR $0 Shell\Compile\Command '' '"$INSTDIR\pdfcrypt.exe" -input "%1" -output "crypt.pdf"'

It seems not work (we're using 1.7b) :(

Can you suggest us also the uninstall part?

Thanks a lot

Fabrizio


Hi Fabrizio,

use

WriteRegStr HKCR $0\Shell\Compile\Command '' '"$INSTDIR\pdfcrypt.exe" -input "%1" -output "crypt.pdf"'
instead of
WriteRegStr HKCR $0 Shell\Compile\Command '' '"$INSTDIR\pdfcrypt.exe" -input "%1" -output "crypt.pdf"'
(you have a typo between $0 and Shell).

To delete this Registry Key you could use
ReadRegStr $0 HKCR .PDF ''
DeleteRegKey HKCR $0\Shell\Compile


Hope it helps -
Regrads,
~ Florian