You are here

Problems with registry::KeyExists

10 posts / 0 new
Last post
br0kenkeychain
Offline
Last seen: 13 years 2 months ago
Joined: 2007-11-21 22:04
Problems with registry::KeyExists

I was hesitant to post this since the Invalid command: ${registry::KeyExists} error has already been discussed in detail in previous threads, but none of the explanations so far have solved my problem.

I've installed Dialogs, FindProc, NewAdvSplash, and Registry.
I'm using the 2.3 template,but I'm still getting

Invalid command: ${registry::KeyExists}
Error in script "C:\Documents and Settings\xxx\Desktop\Celtx.nsi" on line 527 -- aborting creation process

of course Registry::SaveKey and DeleteKey don't work either.

Anyone know what's going on?

wraithdu
Offline
Last seen: 10 years 10 months ago
Developer
Joined: 2007-06-27 20:22
Do you have both the plugin

Do you have both the plugin (DLL) in the plugins folder, and the include file (NSH) in the include directory?

Do you have

!include Registry.nsh

at the top of your script?

br0kenkeychain
Offline
Last seen: 13 years 2 months ago
Joined: 2007-11-21 22:04
The DLL and NSH files are in

The DLL and NSH files are in their respective directories,

the top of the script looks like,
!include Registry.nsh
/**************************************************************************
Name: CeltxPortable

Version:

Website:

the include wasn't originally there, so I added it in, though i don't see the point since !include Registry.nsh is also in
; **************************************************************************
; * Includes
; **************************************************************************
!ifdef DOREG | DOREGFILE ; add macro only when needed
!include "Registry.nsh" ; add registry manipulation macros, not included to NSIS by default
!endif
!include "WordFunc.nsh" ; add header for word manipulation
!insertmacro "WordFind" ; add function for splitting strings
!include "FileFunc.nsh" ; add header for file manipulation
!insertmacro "GetParameters" ; add function for retrieving command line parameters
!define VAR_R0 10 ;$R0 - needed for dialogs

I'm still getting the same error.

br0kenkeychain
Offline
Last seen: 13 years 2 months ago
Joined: 2007-11-21 22:04
I'm running out of ideas, so

I'm running out of ideas, so I thought I'd post my regkeys definitions and ask if they're right. Since it's a lot, I didn't linewrap it.

!define REGKEYS 			"HKEY_CLASSES_ROOT\.celtx||HKEY_CLASSES_ROOT\.tceltx||HKEY_CLASSES_ROOT\celtx_auto_file||HKEY_CLASSES_ROOT\celtx_auto_file\shell||HKEY_CLASSES_ROOT\celtx_auto_file\shell\open||HKEY_CLASSES_ROOT\celtx_auto_file\shell\open\ddeexec||HKEY_CLASSES_ROOT\celtx_auto_file\shell\open\ddeexec\Topic||HKEY_CLASSES_ROOT\celtx_auto_file\shell\open\ddeexec\Application||HKEY_CLASSES_ROOT\celtx_auto_file\shell\open\command||HKEY_CLASSES_ROOT\celtx_auto_file\DefaultIcon||HKEY_CLASSES_ROOT\celtx_tmpl_file||HKEY_CLASSES_ROOT\celtx_tmpl_file\shell||HKEY_CLASSES_ROOT\celtx_tmpl_file\shell\open||HKEY_CLASSES_ROOT\celtx_tmpl_file\shell\ddeexec||HKEY_CLASSES_ROOT\celtx_tmpl_file\shell\open\ddeexec\Topic||HKEY_CLASSES_ROOT\celtx_tmpl_file\shell\open\ddeexec\Application||HKEY_CLASSES_ROOT\celtx_tmpl_file\shell\open\command||HKEY_CLASSES_ROOT\celtx_tmpl_file\DefaultIcon||HKEY_CLASSES_ROOT\CLSID\{0D68D6D0-D93D-4D08-A30D-F00DD1F45B24}\InProcServer32||HKEY_LOCAL_MACHINE\SOFTWARE\Greyfirst||HKEY_LOCAL_MACHINE\SOFTWARE\Greyfirst\Celtx 0.9.9.5||HKEY_LOCAL_MACHINE\SOFTWARE\Greyfirst\Celtx 0.9.9.5\extensions||HKEY_LOCAL_MACHINE\SOFTWARE\Greyfirst\Celtx 0.9.9.5\bin||HKEY_LOCAL_MACHINE\SOFTWARE\Greyfirst\Celtx||HKEY_LOCAL_MACHINE\SOFTWARE\Greyfirst\Celtx\0.9.9.5 (en-US)||HKEY_LOCAL_MACHINE\SOFTWARE\Greyfirst\Celtx\0.9.9.5 (en-US)\Uninstall||HKEY_LOCAL_MACHINE\SOFTWARE\Greyfirst\Celtx\0.9.9.5 (en-US)\Main||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\shell||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\shell\properties||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\shell\properties\command||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\shell\open||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\shell\open\command||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\InstallInfo||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\DefaultIcon||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\Capabilities||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\Capabilities\StartMenu||HKEY_LOCAL_MACHINE\SOFTWARE\Clients\StartMenuInternet\CELTX.EXE\Capabilities\FileAssociations||HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\RNG||HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MediaPlayer\ShimInclusionList\CELTX.EXE||HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\celtx.exe||HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Celtx (0.9.9.5)||HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Reporting\EventCache\7971f918-a847-4430-9279-4a52d1efe18d||HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Celtx||HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Celtx\0.9.9.5 (en-US)||HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Celtx\0.9.9.5 (en-US)\Uninstall||HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications||HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Dhcp\Parameters||HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dhcp\Parameters||HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\*||HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\exe||HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021493-0000-0000-C000-000000000046}\Enum||HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Discardable\PostSetup\Component Categories\{00021494-0000-0000-C000-000000000046}\Enum||HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StreamMRU||HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\106||HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{75048700-EF1F-11D0-9888-006097DEACF9}\Count||HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags\1\Desktop"

[It is important to use PREs, so that you don't widen the page. Fixed for you - Ryan]

rab040ma
Offline
Last seen: 6 days 16 hours ago
Joined: 2007-08-27 13:35
Troubleshooting

One way to troubleshoot that is to comment that define out, and include one
with just a single, simple registry key, and see if that works. That would
let you know if the long define is a problem. If one key works, you can
add the others back one at a time until it breaks again -- and report it
to the appropriate topic, since that would indicate a problem with that
Portable App Creator script.

You could also try compiling one of the simple NSI scripts that includes
a registry setting, and see if the registry add-in works there. If it
doesn't work with a simpler script, then it is likely something is wrong
with the path or way NSIS is set up.

By the way, when you post something that is really long, you should put
it inside "PRE" tags.

MC

br0kenkeychain
Offline
Last seen: 13 years 2 months ago
Joined: 2007-11-21 22:04
tried it

commenting out the definition didn't help.
I also tried the registrytest example included with the plugin.

The example uses,

${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\NSIS" $R0

and there's no error during compilation.

The Portableapps template uses,

${registry::KeyExists} "$R9" "$R7" ; check whether registry key exists

and there is an error during compilation.
The only difference is the quotes, and they don't matter.
The problem may be elsewhere in the script, but I'm not sure where, so if it helps, here's the makensisw output for the template,
http://pastebin.ca/797309

and thanks, I will keep pre in mind.

sag47
Offline
Last seen: 10 years 2 months ago
Joined: 2007-11-17 16:19
Forget

Forget ${registry::KeyExists} completely. I take it you are trying to detect NSIS. I have written a macro that does this for you:

!macro DetectNSIS
  Var /GLOBAL NSISPLUGINS
  Var /GLOBAL NSISINCLUDE
  Var /GLOBAL NSISROOT
  Var /GLOBAL NSISINSTALLED
; Detect NSIS
    DetailPrint "Checking for NSIS..."
    Sleep 1000
    DetailPrint ""
    Push $0
    ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NSIS" "InstallLocation"
    Push $0
    Exch $EXEDIR
    Exch $EXEDIR
    Pop $0
    IfFileExists $0 NSISINSTALLED NSISNOTINSTALLED
    
    NSISNOTINSTALLED:
    Push $0
    ReadRegStr $0 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NSIS" "InstallLocation"
    Push $0
    Exch $EXEDIR
    Exch $EXEDIR
    Pop $0
    IfFileExists $0 NSISINSTALLED
    StrCpy $NSISINSTALLED 0
    Goto DetectNSISFinish
    
    NSISINSTALLED:
    StrCpy $NSISINSTALLED 1
  DetectNSISFinish:
; Get NSIS DIR
  ReadRegStr $1 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NSIS" "InstallLocation"
  IfFileExists $1 +2
  ReadRegStr $1 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NSIS" "InstallLocation"
  StrCpy $NSISROOT "$1"
  StrCpy $NSISPLUGINS "$1\Plugins"
  StrCpy $NSISINCLUDE "$1\Include"
!macroend











Usage:
!insertmacro DetectNSIS
StrCmp $NSISINSTALLED 1 where_to_go_if_installed not_installed

It also creates the following variables for you:
$NSISROOT > root DIR of detected NSIS
$NSISPLUGINS > plugins DIR of detected NSIS
$NSISINCLUDE > include DIR of detected NSIS

I pulled that function out of my custom NSIS installer which detects NSIS, the source can be found at:
http://www.pages.drexel.edu/~sag47/source/NSIS-Installer.zip

Just in case you want to compile it yourself to see how it works.

Can someone tell me how to create a code-block in a forum post? it all looks messy.
SAM

[Code blocks are marked by PRE tags (i.e. <pre>SomeCode</pre>). I've fixed this for you. - Ryan]

What's a signature?

sag47
Offline
Last seen: 10 years 2 months ago
Joined: 2007-11-17 16:19
Maybe something better for your solution

If you notice !include "Registry.nsh". There is no Registry.nsh in the NSIS includes or in the entire NSIS DIR for that matter. And I was looking in the FirefoxPortable source and there is no Registry.nsh file which means it can't compile if it doesn't exist.

If you are not trying to detect NSIS then here is some general knowledge about NSIS. NSIS has a built in function to read registry entries called ReadRegStr.

It can be used to read registry entries and then use StrCmp to see if the registry entry holds a value. If I'm losing you let me know but if you search the NSIS help documentation for these terms then it gives a great description of these commands.

SAM

What's a signature?

sag47
Offline
Last seen: 10 years 2 months ago
Joined: 2007-11-17 16:19
If you post your script or

If you post your script or provide a link to it then I can fix it for you and post the fix. Also explain what you are trying to achieve with your script.
SAM

What's a signature?

br0kenkeychain
Offline
Last seen: 13 years 2 months ago
Joined: 2007-11-21 22:04
I'm trying to make Celtx

I'm trying to make Celtx portable. Celtx is an open source program for screenwriting. It actually compiled with HM NIS, It's slow to open, but here's the code using the portableapps template.

http://pastebin.ca/806328

Log in or register to post comments